Skip to content

Commit

Permalink
Merge branch 'refs/heads/1.20' into 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
UnlikePaladin committed Nov 20, 2024
2 parents 1362c03 + cae56ef commit 8c9ebdc
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 3 deletions.
7 changes: 7 additions & 0 deletions common/src/main/java/org/figuramc/figura/avatar/Avatar.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public class Avatar {
public int animationComplexity;
public final Instructions complexity;
public final Instructions init, render, worldRender, tick, worldTick, animation;
public final Map<String, Instructions> customInstructions = new HashMap<>();
public final RefilledNumber particlesRemaining, soundsRemaining;
private Avatar(UUID owner, EntityType<?> type, String name) {
this.owner = owner;
Expand All @@ -146,6 +147,12 @@ private Avatar(UUID owner, EntityType<?> type, String name) {
this.particlesRemaining = new RefilledNumber(permissions.get(Permissions.PARTICLES));
this.soundsRemaining = new RefilledNumber(permissions.get(Permissions.SOUNDS));
this.entityName = name == null ? "" : name;

for (Collection<Permissions> pluginPermissions : PermissionManager.CUSTOM_PERMISSIONS.values()) {
for (Permissions customPermission : pluginPermissions) {
customInstructions.putIfAbsent(customPermission.name, new Instructions(permissions.get(customPermission)));
}
}
}

public Avatar(UUID owner) {
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/java/org/figuramc/figura/config/Configs.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.figuramc.figura.avatar.local.CacheAvatarLoader;
import org.figuramc.figura.avatar.local.LocalAvatarFetcher;
import org.figuramc.figura.backend2.NetworkStuff;
import org.figuramc.figura.entries.EntryPointManager;
import org.figuramc.figura.gui.FiguraToast;
import org.figuramc.figura.gui.screens.ConfigScreen;
import org.figuramc.figura.lua.FiguraLuaPrinter;
Expand Down Expand Up @@ -270,6 +271,7 @@ public void onChange() {
super.onChange();
PermissionManager.reinit();
LocalAvatarFetcher.reinit();
EntryPointManager.reinit();
}
};
public static final ConfigType.IPConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public static void init() {
EventsAPI.initEntryPoints(load("figura_event", FiguraEvent.class));
}

public static void reinit() {
PermissionManager.initEntryPoints(load("figura_permissions", FiguraPermissions.class));
}

@ExpectPlatform
private static <T> Set<T> load(String name, Class<T> clazz) {
throw new AssertionError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelPart;
import org.figuramc.figura.model.ParentType;

import java.util.Collection;
import java.util.function.Function;
Expand All @@ -22,4 +23,13 @@ public interface FiguraVanillaPart {
* the string is the parts name, case-insensitive, where the mod ID will be added into the final part name, as "ID_NAME"
*/
Collection<Pair<String, Function<EntityModel<?>, ModelPart>>> getParts();

/**
* @return returns a collection of a pair of the part name and a function to get its model part
* the function consists about giving the current Entity Model and getting a Model Part for that Entity
* the string is the parts name, case-insensitive, where the mod ID will be added into the final part name, as "ID_NAME",
* this version supports Parent Types, you can use either.
*/

Collection<Pair<String, Pair<Function<EntityModel<?>, ModelPart>, ParentType>>> getPartsWithParent();
}
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ public VanillaModelAPI(Avatar owner) {
allParts.put(name, model);
parts.add(model);
}
for (Pair<String, Pair<Function<EntityModel<?>, ModelPart>, ParentType>> part : entrypoint.getPartsWithParent()) {
String name = ID + "_" + part.getFirst().toUpperCase(Locale.US);
VanillaModelPart model = new VanillaModelPart(owner, name, part.getSecond().getSecond(), part.getSecond().getFirst());
allParts.put(name, model);
parts.add(model);
}

// add to group list
VanillaGroupPart group = new VanillaGroupPart(owner, ID, parts.toArray(new VanillaModelPart[0]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ else if (hasCapeOrElytra)
if (hasArmor) {
model.addGroup(HelmetPivot, FiguraVec3.of(0, 24, 0), head);
model.addGroup(ChestplatePivot, FiguraVec3.of(0, 24, 0), body);
model.addGroup(LeftElytra, FiguraVec3.of(0, 24, 0), body);
model.addGroup(RightElytra, FiguraVec3.of(0, 24, 0), body);
model.addGroup(LeftElytraPivot, FiguraVec3.of(0, 24, 0), body);
model.addGroup(RightElytraPivot, FiguraVec3.of(0, 24, 0), body);
model.addGroup(LeftShoulderPivot, FiguraVec3.of(-6, 24, 0), leftArm);
model.addGroup(RightShoulderPivot, FiguraVec3.of(6, 24, 0), rightArm);
model.addGroup(LeggingsPivot, FiguraVec3.of(0, 12, 0), body);
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mappings = 1
enabled_platforms = fabric,forge,neoforge

# Mod Properties
mod_version = 0.1.5-rc.3
mod_version = 0.1.5-rc.4
maven_group = org.figuramc
archives_base_name = figura
assets_version = v2
Expand Down

0 comments on commit 8c9ebdc

Please sign in to comment.