Audit-2 : strip EF extension chain + AnimationConfig dead fields (-334 LOC)
H-02 (EF extension chain DEAD) :
- Delete 5 unreferenced EF-derived files :
- event/EntityPatchRegistryEvent (ModLoader event for third-party patch
registration — no third-party EF mods to host).
- event/RegisterResourceLayersEvent (extra renderer layers registration
event — no consumers).
- render/layer/LayerUtil (+ empty package) — sole LayerProvider interface
only used by the deleted RegisterResourceLayersEvent.
- render/item/RenderItemBase (+ empty package) — abstract weapon renderer
stub, TiedUp does not host weapon trails.
- asset/SelfAccessor — AssetAccessor variant never created.
- PatchedRenderersEvent : drop inner classes RegisterItemRenderer (tied to
RenderItemBase) and Modify (never posted). Keep Add, used by
TiedUpRenderEngine.
- JsonAssetLoader : remove loadArmature(ArmatureContructor) + its private
getJoint helper. Armatures are loaded via the GLB path in Phase 1 — this
EF JSON route has no callers.
- TiedUpRigRegistry : drop inner interface ArmatureContructor (EF-style
typo preserved) now that loadArmature is gone.
- EntityPatchProvider : drop CUSTOM_CAPABILITIES map + putCustomEntityPatch
+ clearCustom. No third-party extension surface needed ; inline the
provider lookup to CAPABILITIES only.
H-03 (TiedUpAnimationConfig dead fields) :
- Remove enableOriginalModel, enableAnimatedFirstPersonModel,
enableCosmetics, enablePovAction, autoSwitchCamera, preferenceWork,
combatPreferredItems, miningPreferredItems. None had callers — they were
inherited from EF ClientConfig without a TiedUp consumer.
- Keep activateComputeShader — read at SkinnedMesh.java:249 to toggle the
GPU skinning path.
Compile green, 20/20 rig tests still green.
This commit is contained in:
@@ -6,39 +6,24 @@
|
|||||||
|
|
||||||
package com.tiedup.remake.rig;
|
package com.tiedup.remake.rig;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remplace {@code yesman.epicfight.config.ClientConfig} du fork upstream.
|
* Remplace {@code yesman.epicfight.config.ClientConfig} du fork upstream.
|
||||||
* Expose uniquement les flags pertinents au pipeline animation/rendu RIG.
|
* Expose uniquement les flags pertinents au pipeline animation/rendu RIG.
|
||||||
*
|
*
|
||||||
* <p><b>Note Phase 0</b> : tous les flags sont des {@code static final} avec
|
* <p><b>Note Phase 0</b> : les flags sont des {@code static final} avec
|
||||||
* valeurs par défaut hardcodées. À convertir en {@code ForgeConfigSpec} réel
|
* valeurs par défaut hardcodées. À convertir en {@code ForgeConfigSpec} réel
|
||||||
* (TOML config file) Phase 2 ou plus tard si on veut permettre la
|
* (TOML config file) Phase 2 ou plus tard si on veut permettre la
|
||||||
* configuration utilisateur.</p>
|
* configuration utilisateur.</p>
|
||||||
*
|
|
||||||
* <p>Valeurs combat (autoSwitchCamera, preferenceWork, combatPreferredItems,
|
|
||||||
* miningPreferredItems) = defaults no-op, on ne les utilise pas. Les refs
|
|
||||||
* restantes dans LocalPlayerPatch/ClientPlayerPatch seront strippées en
|
|
||||||
* Phase 2 quand on simplifiera ces classes.</p>
|
|
||||||
*/
|
*/
|
||||||
public final class TiedUpAnimationConfig {
|
public final class TiedUpAnimationConfig {
|
||||||
|
|
||||||
private TiedUpAnimationConfig() {}
|
private TiedUpAnimationConfig() {}
|
||||||
|
|
||||||
// Rendu
|
/**
|
||||||
|
* Toggle pour le chemin "compute shader" de {@code SkinnedMesh.draw} —
|
||||||
|
* quand true et qu'un {@code ComputeShaderSetup} est disponible, la mesh
|
||||||
|
* est skinnée côté GPU (plus rapide sur modèles lourds). False (défaut)
|
||||||
|
* = skin CPU comme vanilla.
|
||||||
|
*/
|
||||||
public static final boolean activateComputeShader = false;
|
public static final boolean activateComputeShader = false;
|
||||||
public static final boolean enableOriginalModel = true; // rendu vanilla model = on par défaut
|
|
||||||
public static final boolean enableAnimatedFirstPersonModel = true;
|
|
||||||
public static final boolean enableCosmetics = true;
|
|
||||||
public static final boolean enablePovAction = false; // POV action combat → off
|
|
||||||
public static final boolean autoSwitchCamera = false; // combat camera switch → off
|
|
||||||
|
|
||||||
// Combat (stubs pour compat refs LocalPlayerPatch Phase 0 — à supprimer
|
|
||||||
// en Phase 2 avec le reste du strip combat)
|
|
||||||
public static final Object preferenceWork = new Object() {
|
|
||||||
public boolean checkHitResult() { return false; }
|
|
||||||
};
|
|
||||||
public static final Set<Object> combatPreferredItems = Set.of();
|
|
||||||
public static final Set<Object> miningPreferredItems = Set.of();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,8 @@
|
|||||||
|
|
||||||
package com.tiedup.remake.rig;
|
package com.tiedup.remake.rig;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import com.tiedup.remake.rig.anim.types.DirectStaticAnimation;
|
import com.tiedup.remake.rig.anim.types.DirectStaticAnimation;
|
||||||
import com.tiedup.remake.rig.armature.Armature;
|
|
||||||
import com.tiedup.remake.rig.armature.Joint;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remplace les registries {@code yesman.epicfight.gameasset.Animations} et
|
* Remplace les registries {@code yesman.epicfight.gameasset.Animations} et
|
||||||
@@ -19,13 +15,9 @@ import com.tiedup.remake.rig.armature.Joint;
|
|||||||
* n'utilise PAS les animations combat EF (BIPED_IDLE, BIPED_WALK, etc. —
|
* n'utilise PAS les animations combat EF (BIPED_IDLE, BIPED_WALK, etc. —
|
||||||
* ARR assets) — on authore les nôtres en Phase 4 via addon Blender.
|
* ARR assets) — on authore les nôtres en Phase 4 via addon Blender.
|
||||||
*
|
*
|
||||||
* <p>Ce registry expose juste :</p>
|
* <p>Ce registry expose juste {@link #EMPTY_ANIMATION} — animation singleton
|
||||||
* <ul>
|
* "ne fait rien", référencée par LayerOffAnimation et StaticAnimation pour
|
||||||
* <li>{@link #EMPTY_ANIMATION} — animation singleton "ne fait rien", référencée
|
* le défaut.</p>
|
||||||
* par LayerOffAnimation et StaticAnimation pour le défaut.</li>
|
|
||||||
* <li>{@link ArmatureContructor} — interface fonctionnelle pour construire
|
|
||||||
* des armatures custom (re-exposée depuis {@code TiedUpRigRegistry.ArmatureContructor}).</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
*
|
||||||
* <p>Les vrais registries TiedUp (TiedUpAnimationRegistry, TiedUpArmatures,
|
* <p>Les vrais registries TiedUp (TiedUpAnimationRegistry, TiedUpArmatures,
|
||||||
* TiedUpMeshRegistry) sont prévus en Phase 2-3 et gèreront le scan resource
|
* TiedUpMeshRegistry) sont prévus en Phase 2-3 et gèreront le scan resource
|
||||||
@@ -55,14 +47,4 @@ public final class TiedUpRigRegistry {
|
|||||||
return EMPTY_ANIMATION_REGISTRY_NAME;
|
return EMPTY_ANIMATION_REGISTRY_NAME;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface fonctionnelle de construction d'armature. Re-exposée depuis
|
|
||||||
* {@code TiedUpRigRegistry.ArmatureContructor} upstream pour que les callers
|
|
||||||
* (JsonAssetLoader, etc.) aient accès au même type.
|
|
||||||
*/
|
|
||||||
@FunctionalInterface
|
|
||||||
public interface ArmatureContructor<T extends Armature> {
|
|
||||||
T invoke(String name, int jointNumber, Joint joint, Map<String, Joint> jointMap);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ import com.tiedup.remake.rig.math.MathUtils;
|
|||||||
import com.tiedup.remake.rig.math.OpenMatrix4f;
|
import com.tiedup.remake.rig.math.OpenMatrix4f;
|
||||||
import com.tiedup.remake.rig.math.Vec3f;
|
import com.tiedup.remake.rig.math.Vec3f;
|
||||||
import com.tiedup.remake.rig.math.Vec4f;
|
import com.tiedup.remake.rig.math.Vec4f;
|
||||||
import com.tiedup.remake.rig.TiedUpRigRegistry.ArmatureContructor;
|
|
||||||
import com.tiedup.remake.rig.TiedUpRigConstants;
|
import com.tiedup.remake.rig.TiedUpRigConstants;
|
||||||
|
|
||||||
public class JsonAssetLoader {
|
public class JsonAssetLoader {
|
||||||
@@ -456,119 +455,6 @@ public class JsonAssetLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Armature> T loadArmature(ArmatureContructor<T> constructor) {
|
|
||||||
if (this.resourceLocation == null) {
|
|
||||||
throw new AssetLoadingException("Can't load armature: Resource location is null.");
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonObject obj = this.rootJson.getAsJsonObject("armature");
|
|
||||||
TransformFormat transformFormat = getAsTransformFormatOrDefault(obj, "armature_format");
|
|
||||||
JsonObject hierarchy = obj.get("hierarchy").getAsJsonArray().get(0).getAsJsonObject();
|
|
||||||
JsonArray nameAsVertexGroups = obj.getAsJsonArray("joints");
|
|
||||||
Map<String, Integer> jointIds = Maps.newHashMap();
|
|
||||||
|
|
||||||
int id = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < nameAsVertexGroups.size(); i++) {
|
|
||||||
String name = nameAsVertexGroups.get(i).getAsString();
|
|
||||||
|
|
||||||
if (name.equals(COORD_BONE)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
jointIds.put(name, id);
|
|
||||||
id++;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Joint> jointMap = Maps.newHashMap();
|
|
||||||
Joint joint = getJoint(hierarchy, jointIds, jointMap, transformFormat, true);
|
|
||||||
joint.initOriginTransform(new OpenMatrix4f());
|
|
||||||
|
|
||||||
String armatureName = this.resourceLocation.toString().replaceAll("(animmodels/|\\.json)", "");
|
|
||||||
|
|
||||||
return constructor.invoke(armatureName, jointMap.size(), joint, jointMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Joint getJoint(JsonObject object, Map<String, Integer> jointIdMap, Map<String, Joint> jointMap, TransformFormat transformFormat, boolean root) {
|
|
||||||
String name = object.get("name").getAsString();
|
|
||||||
|
|
||||||
if (!jointIdMap.containsKey(name)) {
|
|
||||||
throw new AssetLoadingException("Can't load joint: joint name " + name + " doesn't exist in armature hierarchy.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip Coord bone
|
|
||||||
if (name.equals(COORD_BONE)) {
|
|
||||||
JsonArray coordChildren = object.get("children").getAsJsonArray();
|
|
||||||
|
|
||||||
if (coordChildren.isEmpty()) {
|
|
||||||
throw new AssetLoadingException("No children for Coord bone");
|
|
||||||
} else if (coordChildren.size() > 1) {
|
|
||||||
throw new AssetLoadingException("Coord bone can't have multiple children");
|
|
||||||
} else {
|
|
||||||
return getJoint(coordChildren.get(0).getAsJsonObject(), jointIdMap, jointMap, transformFormat, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonElement transform = GsonHelper.getNonNull(object, "transform");
|
|
||||||
|
|
||||||
// WORKAROUND: The case when transform format is wrongly specified!
|
|
||||||
if (transformFormat == TransformFormat.ATTRIBUTES && transform.isJsonArray()) {
|
|
||||||
transformFormat = TransformFormat.MATRIX;
|
|
||||||
} else if (transformFormat == TransformFormat.MATRIX && transform.isJsonObject()) {
|
|
||||||
transformFormat = TransformFormat.ATTRIBUTES;
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenMatrix4f localMatrix = null;
|
|
||||||
|
|
||||||
switch (transformFormat) {
|
|
||||||
case MATRIX -> {
|
|
||||||
float[] matrixElements = ParseUtil.toFloatArrayPrimitive(GsonHelper.convertToJsonArray(transform, "transform"));
|
|
||||||
localMatrix = OpenMatrix4f.load(null, matrixElements);
|
|
||||||
localMatrix.transpose();
|
|
||||||
|
|
||||||
if (root) {
|
|
||||||
localMatrix.mulFront(BLENDER_TO_MINECRAFT_COORD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case ATTRIBUTES -> {
|
|
||||||
JsonObject transformObject = transform.getAsJsonObject();
|
|
||||||
JsonArray locArray = transformObject.get("loc").getAsJsonArray();
|
|
||||||
JsonArray rotArray = transformObject.get("rot").getAsJsonArray();
|
|
||||||
JsonArray scaArray = transformObject.get("sca").getAsJsonArray();
|
|
||||||
JointTransform jointTransform
|
|
||||||
= JointTransform.fromPrimitives(
|
|
||||||
locArray.get(0).getAsFloat()
|
|
||||||
, locArray.get(1).getAsFloat()
|
|
||||||
, locArray.get(2).getAsFloat()
|
|
||||||
, -rotArray.get(1).getAsFloat()
|
|
||||||
, -rotArray.get(2).getAsFloat()
|
|
||||||
, -rotArray.get(3).getAsFloat()
|
|
||||||
, rotArray.get(0).getAsFloat()
|
|
||||||
, scaArray.get(0).getAsFloat()
|
|
||||||
, scaArray.get(1).getAsFloat()
|
|
||||||
, scaArray.get(2).getAsFloat()
|
|
||||||
);
|
|
||||||
|
|
||||||
localMatrix = jointTransform.toMatrix();
|
|
||||||
|
|
||||||
if (root) {
|
|
||||||
localMatrix.mulFront(BLENDER_TO_MINECRAFT_COORD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Joint joint = new Joint(name, jointIdMap.get(name), localMatrix);
|
|
||||||
jointMap.put(name, joint);
|
|
||||||
|
|
||||||
if (object.has("children")) {
|
|
||||||
for (JsonElement children : object.get("children").getAsJsonArray()) {
|
|
||||||
joint.addSubJoints(getJoint(children.getAsJsonObject(), jointIdMap, jointMap, transformFormat, false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return joint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AnimationClip loadClipForAnimation(StaticAnimation animation) {
|
public AnimationClip loadClipForAnimation(StaticAnimation animation) {
|
||||||
if (this.rootJson == null) {
|
if (this.rootJson == null) {
|
||||||
throw new AssetLoadingException("Can't find animation in path: " + animation);
|
throw new AssetLoadingException("Can't find animation in path: " + animation);
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Derived from Epic Fight (https://github.com/Epic-Fight/epicfight)
|
|
||||||
* by the Epic Fight Team, licensed under GPLv3.
|
|
||||||
* Modifications © 2026 TiedUp! Remake Contributors, distributed under GPLv3.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.tiedup.remake.rig.asset;
|
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
|
|
||||||
public record SelfAccessor<A>(ResourceLocation registryName, A asset) implements AssetAccessor<A> {
|
|
||||||
public static <A> SelfAccessor<A> create(ResourceLocation registryName, A asset) {
|
|
||||||
return new SelfAccessor<> (registryName, asset);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public A get() {
|
|
||||||
return this.asset;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean inRegistry() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* Derived from Epic Fight (https://github.com/Epic-Fight/epicfight)
|
|
||||||
* by the Epic Fight Team, licensed under GPLv3.
|
|
||||||
* Modifications © 2026 TiedUp! Remake Contributors, distributed under GPLv3.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.tiedup.remake.rig.event;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
|
||||||
import net.minecraftforge.fml.event.IModBusEvent;
|
|
||||||
import com.tiedup.remake.rig.patch.EntityPatch;
|
|
||||||
|
|
||||||
public class EntityPatchRegistryEvent extends Event implements IModBusEvent {
|
|
||||||
private final Map<EntityType<?>, Function<Entity, Supplier<EntityPatch<?>>>> typeEntry;
|
|
||||||
|
|
||||||
public EntityPatchRegistryEvent(Map<EntityType<?>, Function<Entity, Supplier<EntityPatch<?>>>> typeEntry) {
|
|
||||||
this.typeEntry = typeEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<EntityType<?>, Function<Entity, Supplier<EntityPatch<?>>>> getTypeEntry() {
|
|
||||||
return this.typeEntry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,61 +9,29 @@ package com.tiedup.remake.rig.event;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
import net.minecraftforge.eventbus.api.Event;
|
||||||
import net.minecraftforge.fml.event.IModBusEvent;
|
import net.minecraftforge.fml.event.IModBusEvent;
|
||||||
import com.tiedup.remake.rig.render.PatchedEntityRenderer;
|
import com.tiedup.remake.rig.render.PatchedEntityRenderer;
|
||||||
import com.tiedup.remake.rig.render.item.RenderItemBase;
|
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public abstract class PatchedRenderersEvent extends Event implements IModBusEvent {
|
public abstract class PatchedRenderersEvent extends Event implements IModBusEvent {
|
||||||
public static class RegisterItemRenderer extends PatchedRenderersEvent {
|
|
||||||
private final Map<ResourceLocation, Function<JsonElement, RenderItemBase>> itemRenderers;
|
|
||||||
|
|
||||||
public RegisterItemRenderer(Map<ResourceLocation, Function<JsonElement, RenderItemBase>> itemRenderers) {
|
|
||||||
this.itemRenderers = itemRenderers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addItemRenderer(ResourceLocation rl, Function<JsonElement, RenderItemBase> provider) {
|
|
||||||
if (this.itemRenderers.containsKey(rl)) {
|
|
||||||
throw new IllegalArgumentException("Item renderer " + rl + " already registered.");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.itemRenderers.put(rl, provider);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Add extends PatchedRenderersEvent {
|
public static class Add extends PatchedRenderersEvent {
|
||||||
private final Map<EntityType<?>, Function<EntityType<?>, PatchedEntityRenderer>> entityRendererProvider;
|
private final Map<EntityType<?>, Function<EntityType<?>, PatchedEntityRenderer>> entityRendererProvider;
|
||||||
private final EntityRendererProvider.Context context;
|
private final EntityRendererProvider.Context context;
|
||||||
|
|
||||||
public Add(Map<EntityType<?>, Function<EntityType<?>, PatchedEntityRenderer>> entityRendererProvider, EntityRendererProvider.Context context) {
|
public Add(Map<EntityType<?>, Function<EntityType<?>, PatchedEntityRenderer>> entityRendererProvider, EntityRendererProvider.Context context) {
|
||||||
this.entityRendererProvider = entityRendererProvider;
|
this.entityRendererProvider = entityRendererProvider;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPatchedEntityRenderer(EntityType<?> entityType, Function<EntityType<?>, PatchedEntityRenderer> provider) {
|
public void addPatchedEntityRenderer(EntityType<?> entityType, Function<EntityType<?>, PatchedEntityRenderer> provider) {
|
||||||
this.entityRendererProvider.put(entityType, provider);
|
this.entityRendererProvider.put(entityType, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityRendererProvider.Context getContext() {
|
public EntityRendererProvider.Context getContext() {
|
||||||
return this.context;
|
return this.context;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Modify extends PatchedRenderersEvent {
|
|
||||||
private final Map<EntityType<?>, PatchedEntityRenderer> renderers;
|
|
||||||
|
|
||||||
public Modify(Map<EntityType<?>, PatchedEntityRenderer> renderers) {
|
|
||||||
this.renderers = renderers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PatchedEntityRenderer get(EntityType<?> entityType) {
|
|
||||||
return this.renderers.get(entityType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Derived from Epic Fight (https://github.com/Epic-Fight/epicfight)
|
|
||||||
* by the Epic Fight Team, licensed under GPLv3.
|
|
||||||
* Modifications © 2026 TiedUp! Remake Contributors, distributed under GPLv3.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.tiedup.remake.rig.event;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.minecraft.client.model.EntityModel;
|
|
||||||
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
|
||||||
import com.tiedup.remake.rig.mesh.SkinnedMesh;
|
|
||||||
import com.tiedup.remake.rig.render.layer.LayerUtil;
|
|
||||||
import com.tiedup.remake.rig.patch.LivingEntityPatch;
|
|
||||||
|
|
||||||
public class RegisterResourceLayersEvent<E extends LivingEntity, T extends LivingEntityPatch<E>, M extends EntityModel<E>, R extends LivingEntityRenderer<E, M>, AM extends SkinnedMesh> extends Event {
|
|
||||||
private final Map<ResourceLocation, LayerUtil.LayerProvider<E, T, M, R, AM>> layersbyid;
|
|
||||||
|
|
||||||
public RegisterResourceLayersEvent(Map<ResourceLocation, LayerUtil.LayerProvider<E, T, M, R, AM>> layersbyid) {
|
|
||||||
this.layersbyid = layersbyid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void register(ResourceLocation rl, LayerUtil.LayerProvider<E, T, M, R, AM> layerAdder) {
|
|
||||||
this.layersbyid.put(rl, layerAdder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -30,9 +30,7 @@ import com.tiedup.remake.rig.TiedUpRigConstants;
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Pas de projectile (ProjectilePatch / ArrowPatch strippés)</li>
|
* <li>Pas de projectile (ProjectilePatch / ArrowPatch strippés)</li>
|
||||||
* <li>Pas de GlobalMobPatch fallback sur gamerule stun</li>
|
* <li>Pas de GlobalMobPatch fallback sur gamerule stun</li>
|
||||||
* <li>Pas d'EntityPatchRegistryEvent posté à ModLoader (pas de tiers mods EF pour l'instant)</li>
|
* <li>Pas d'event posté à ModLoader (pas de tiers mods EF pour l'instant)</li>
|
||||||
* <li>{@link #CUSTOM_CAPABILITIES} reste exposé via {@link #putCustomEntityPatch(EntityType, Function)}
|
|
||||||
* pour un hook d'extension future</li>
|
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <p><b>Attention MCA</b> : on ne doit PAS enregistrer {@link EntityType#VILLAGER}
|
* <p><b>Attention MCA</b> : on ne doit PAS enregistrer {@link EntityType#VILLAGER}
|
||||||
@@ -50,9 +48,6 @@ public class EntityPatchProvider implements ICapabilityProvider, NonNullSupplier
|
|||||||
/** Provider map populée au setup, lu au spawn entity. */
|
/** Provider map populée au setup, lu au spawn entity. */
|
||||||
private static final Map<EntityType<?>, Function<Entity, Supplier<EntityPatch<?>>>> CAPABILITIES = Maps.newHashMap();
|
private static final Map<EntityType<?>, Function<Entity, Supplier<EntityPatch<?>>>> CAPABILITIES = Maps.newHashMap();
|
||||||
|
|
||||||
/** Hook extension pour mods/datapacks tiers. Prioritaire sur {@link #CAPABILITIES}. */
|
|
||||||
private static final Map<EntityType<?>, Function<Entity, Supplier<EntityPatch<?>>>> CUSTOM_CAPABILITIES = Maps.newHashMap();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* À appeler en {@code FMLCommonSetupEvent.event.enqueueWork(...)}.
|
* À appeler en {@code FMLCommonSetupEvent.event.enqueueWork(...)}.
|
||||||
*
|
*
|
||||||
@@ -92,32 +87,13 @@ public class EntityPatchProvider implements ICapabilityProvider, NonNullSupplier
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Enregistre un patch provider custom pour un {@link EntityType} donné.
|
|
||||||
* Utilisé pour extensions tierces (compat mods) ou datapack-driven patches.
|
|
||||||
*
|
|
||||||
* <p>Prioritaire sur {@link #CAPABILITIES} : un call custom override la
|
|
||||||
* version par défaut si elle existe.</p>
|
|
||||||
*/
|
|
||||||
public static void putCustomEntityPatch(EntityType<?> entityType, Function<Entity, Supplier<EntityPatch<?>>> provider) {
|
|
||||||
CUSTOM_CAPABILITIES.put(entityType, provider);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Nettoie les custom patches (typiquement au datapack reload).
|
|
||||||
*/
|
|
||||||
public static void clearCustom() {
|
|
||||||
CUSTOM_CAPABILITIES.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------- instance ----------
|
// ---------- instance ----------
|
||||||
|
|
||||||
private EntityPatch<?> capability;
|
private EntityPatch<?> capability;
|
||||||
private final LazyOptional<EntityPatch<?>> optional = LazyOptional.of(this);
|
private final LazyOptional<EntityPatch<?>> optional = LazyOptional.of(this);
|
||||||
|
|
||||||
public EntityPatchProvider(Entity entity) {
|
public EntityPatchProvider(Entity entity) {
|
||||||
Function<Entity, Supplier<EntityPatch<?>>> provider =
|
Function<Entity, Supplier<EntityPatch<?>>> provider = CAPABILITIES.get(entity.getType());
|
||||||
CUSTOM_CAPABILITIES.getOrDefault(entity.getType(), CAPABILITIES.get(entity.getType()));
|
|
||||||
|
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
/*
|
|
||||||
* Derived from Epic Fight (https://github.com/Epic-Fight/epicfight)
|
|
||||||
* by the Epic Fight Team, licensed under GPLv3.
|
|
||||||
* Modifications © 2026 TiedUp! Remake Contributors, distributed under GPLv3.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.tiedup.remake.rig.render.item;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stub RIG Phase 0 — renderer pour les items (EF : weapons avec trail,
|
|
||||||
* tools). TiedUp : re-implém Phase 3 pour menottes/laisse/cage rendues
|
|
||||||
* attachées aux joints Tool_R/Tool_L via ItemStack injection.
|
|
||||||
*/
|
|
||||||
public abstract class RenderItemBase {
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* Derived from Epic Fight (https://github.com/Epic-Fight/epicfight)
|
|
||||||
* by the Epic Fight Team, licensed under GPLv3.
|
|
||||||
* Modifications © 2026 TiedUp! Remake Contributors, distributed under GPLv3.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.tiedup.remake.rig.render.layer;
|
|
||||||
|
|
||||||
import net.minecraft.client.model.EntityModel;
|
|
||||||
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
|
|
||||||
import com.tiedup.remake.rig.mesh.SkinnedMesh;
|
|
||||||
import com.tiedup.remake.rig.patch.LivingEntityPatch;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stub RIG Phase 0 — registry de layers additionnels (armor, glow, cape...)
|
|
||||||
* pour renderers EF. Implém complète Phase 2.
|
|
||||||
*/
|
|
||||||
public class LayerUtil {
|
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
public interface LayerProvider<
|
|
||||||
E extends LivingEntity,
|
|
||||||
T extends LivingEntityPatch<E>,
|
|
||||||
M extends EntityModel<E>,
|
|
||||||
R extends LivingEntityRenderer<E, M>,
|
|
||||||
AM extends SkinnedMesh
|
|
||||||
> {
|
|
||||||
void addLayer(R renderer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user