WIP: initial epic fight core extraction (Phase 0)
83 files forkés d'Epic Fight (~18k LOC). Base non-compilable en l'état.
Contenu extrait :
- math/ — OpenMatrix4f, Vec3f/4f/2f, QuaternionUtils, MathUtils, ...
- armature/ — Armature, Joint, JointTransform, HumanoidArmature
- anim/ — Animator, ServerAnimator, ClientAnimator, LivingMotion, ...
- anim/types/ — StaticAnimation, DynamicAnimation, MovementAnimation, LinkAnimation,
ConcurrentLinkAnimation, LayerOffAnimation, EntityState
- anim/client/ — Layer, ClientAnimator, JointMask
- mesh/ — SkinnedMesh, SingleGroupVertexBuilder, Mesh, HumanoidMesh, ...
- cloth/ — AbstractSimulator, ClothSimulator (dépendance transitive de StaticMesh)
- asset/ — JsonAssetLoader, AssetAccessor
- patch/ — EntityPatch, LivingEntityPatch, PlayerPatch, ClientPlayerPatch
- util/ — ParseUtil, TypeFlexibleHashMap
- exception/ — AssetLoadingException
- event/ — PatchedRenderersEvent, PrepareModelEvent, RegisterResourceLayersEvent
- render/ — TiedUpRenderTypes
Headers GPLv3 + attribution injectés sur tous les .java.
Package declarations fixées sur Armature.java et TiedUpRenderTypes.java.
115 imports résiduels à résoudre manuellement :
- yesman.epicfight.main (EpicFightMod, EpicFightSharedConstants) — 30
- yesman.epicfight.gameasset (Animations, Armatures, EpicFightSounds) — 12
- yesman.epicfight.api.physics + physics.ik (combat physics) — 16
- yesman.epicfight.network.* (combat packets) — 13
- yesman.epicfight.world.* (combat entity logic) — 10
- yesman.epicfight.config.ClientConfig — 3
- yesman.epicfight.skill, .client.gui, .particle, .collider — divers combat/UI
Stratégie fix (2-3 sem manuel) : strip usage combat, stubs pour refs
core (EpicFightMod → TiedUpMod, SharedConstants → TiedUpRigConstants,
ClientConfig → TiedUpAnimationConfig).
This commit is contained in:
135
src/main/java/com/tiedup/remake/rig/cloth/AbstractSimulator.java
Normal file
135
src/main/java/com/tiedup/remake/rig/cloth/AbstractSimulator.java
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* 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.cloth;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import yesman.epicfight.api.physics.PhysicsSimulator;
|
||||
import yesman.epicfight.api.physics.SimulationObject;
|
||||
import yesman.epicfight.api.physics.SimulationObject.SimulationObjectBuilder;
|
||||
import yesman.epicfight.api.physics.SimulationProvider;
|
||||
|
||||
public abstract class AbstractSimulator<KEY, B extends SimulationObjectBuilder, PV extends SimulationProvider<O, SO, B, PV>, O, SO extends SimulationObject<B, PV, O>> implements PhysicsSimulator<KEY, B, PV, O, SO> {
|
||||
protected Map<KEY, ObjectWrapper> simulationObjects = Maps.newHashMap();
|
||||
|
||||
@Override
|
||||
public void tick(O simObject) {
|
||||
this.simulationObjects.values().removeIf((keyWrapper) -> {
|
||||
if (keyWrapper.isRunning()) {
|
||||
if (!keyWrapper.runWhen.getAsBoolean()) {
|
||||
keyWrapper.stopRunning();
|
||||
|
||||
if (!keyWrapper.permanent) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (keyWrapper.runWhen.getAsBoolean()) {
|
||||
keyWrapper.startRunning(simObject);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a simulation object and run. Remove when @Param until returns false
|
||||
*/
|
||||
@Override
|
||||
public void runUntil(KEY key, PV provider, B builder, BooleanSupplier until) {
|
||||
this.simulationObjects.put(key, new ObjectWrapper(provider, until, false, builder));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an undeleted simulation object. Run simulation when @Param when returns true
|
||||
*/
|
||||
@Override
|
||||
public void runWhen(KEY key, PV provider, B builder, BooleanSupplier when) {
|
||||
this.simulationObjects.put(key, new ObjectWrapper(provider, when, true, builder));
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop simulation
|
||||
*/
|
||||
@Override
|
||||
public void stop(KEY key) {
|
||||
this.simulationObjects.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restart with the same condition but with another provider
|
||||
*/
|
||||
@Override
|
||||
public void restart(KEY key) {
|
||||
ObjectWrapper kwrap = this.simulationObjects.get(key);
|
||||
|
||||
if (kwrap != null) {
|
||||
this.stop(key);
|
||||
this.simulationObjects.put(key, new ObjectWrapper(kwrap.provider, kwrap.runWhen, kwrap.permanent, kwrap.builder));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning(KEY key) {
|
||||
return this.simulationObjects.containsKey(key) ? this.simulationObjects.get(key).isRunning() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SO> getRunningObject(KEY key) {
|
||||
if (!this.simulationObjects.containsKey(key)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return Optional.ofNullable(this.simulationObjects.get(key).simulationObject);
|
||||
}
|
||||
|
||||
public List<Pair<KEY, SO>> getAllRunningObjects() {
|
||||
return this.simulationObjects.entrySet().stream().filter((entry) -> entry.getValue().isRunning()).map((entry) -> Pair.of(entry.getKey(), entry.getValue().simulationObject)).toList();
|
||||
}
|
||||
|
||||
protected class ObjectWrapper {
|
||||
final PV provider;
|
||||
final B builder;
|
||||
final BooleanSupplier runWhen;
|
||||
final boolean permanent;
|
||||
|
||||
SO simulationObject;
|
||||
boolean isRunning;
|
||||
|
||||
ObjectWrapper(PV key, BooleanSupplier runWhen, boolean permanent, B builder) {
|
||||
this.provider = key;
|
||||
this.runWhen = runWhen;
|
||||
this.permanent = permanent;
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
public void startRunning(O simObject) {
|
||||
this.simulationObject = this.provider.createSimulationData(this.provider, simObject, this.builder);
|
||||
|
||||
if (this.simulationObject != null) {
|
||||
this.isRunning = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void stopRunning() {
|
||||
this.isRunning = false;
|
||||
this.simulationObject = null;
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return this.isRunning;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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.cloth;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import com.tiedup.remake.rig.math.OpenMatrix4f;
|
||||
|
||||
/**
|
||||
* 0: Root,
|
||||
* 1: Thigh_R,
|
||||
* 2: "Leg_R",
|
||||
* 3: "Knee_R",
|
||||
* 4: "Thigh_L",
|
||||
* 5: "Leg_L",
|
||||
* 6: "Knee_L",
|
||||
* 7: "Torso",
|
||||
* 8: "Chest",
|
||||
* 9: "Head",
|
||||
* 10: "Shoulder_R",
|
||||
* 11: "Arm_R",
|
||||
* 12: "Hand_R",
|
||||
* 13: "Tool_R",
|
||||
* 14: "Elbow_R",
|
||||
* 15: "Shoulder_L",
|
||||
* 16: "Arm_L",
|
||||
* 17: "Hand_L",
|
||||
* 18: "Tool_L",
|
||||
* 19: "Elbow_L"
|
||||
**/
|
||||
|
||||
public class ClothColliderPresets {
|
||||
public static final List<Pair<Function<ClothSimulatable, OpenMatrix4f>, ClothSimulator.ClothOBBCollider>> BIPED_SLIM = ImmutableList.<Pair<Function<ClothSimulatable, OpenMatrix4f>, ClothSimulator.ClothOBBCollider>>builder()
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[1], new ClothSimulator.ClothOBBCollider(0.125D, 0.24D, 0.125D, 0.0D, 0.22D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[2], new ClothSimulator.ClothOBBCollider(0.125D, 0.1875D, 0.125D, 0.0D, 0.1875D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[4], new ClothSimulator.ClothOBBCollider(0.125D, 0.24D, 0.125D, 0.0D, 0.22D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[5], new ClothSimulator.ClothOBBCollider(0.125D, 0.1875D, 0.125D, 0.0D, 0.1875D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[7], new ClothSimulator.ClothOBBCollider(0.25D, 0.25D, 0.13D, 0.0D, 0.125D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[8], new ClothSimulator.ClothOBBCollider(0.25D, 0.25D, 0.13D, 0.0D, 0.3D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[9], new ClothSimulator.ClothOBBCollider(0.25D, 0.25D, 0.25D, 0.0D, 0.2D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[11], new ClothSimulator.ClothOBBCollider(0.12D, 0.24D, 0.125D, -0.05D, 0.14D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[12], new ClothSimulator.ClothOBBCollider(0.12D, 0.1875D, 0.125D, -0.05D, 0.14D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[16], new ClothSimulator.ClothOBBCollider(0.12D, 0.24D, 0.125D, 0.05D, 0.14D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[17], new ClothSimulator.ClothOBBCollider(0.12D, 0.1875D, 0.125D, 0.05D, 0.14D, 0.0D)))
|
||||
.build();
|
||||
|
||||
public static final List<Pair<Function<ClothSimulatable, OpenMatrix4f>, ClothSimulator.ClothOBBCollider>> BIPED = ImmutableList.<Pair<Function<ClothSimulatable, OpenMatrix4f>, ClothSimulator.ClothOBBCollider>>builder()
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[1], new ClothSimulator.ClothOBBCollider(0.125D, 0.24D, 0.125D, 0.0D, 0.22D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[2], new ClothSimulator.ClothOBBCollider(0.125D, 0.1875D, 0.125D, 0.0D, 0.1875D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[4], new ClothSimulator.ClothOBBCollider(0.125D, 0.24D, 0.125D, 0.0D, 0.22D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[5], new ClothSimulator.ClothOBBCollider(0.125D, 0.1875D, 0.125D, 0.0D, 0.1875D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[7], new ClothSimulator.ClothOBBCollider(0.25D, 0.25D, 0.13D, 0.0D, 0.125D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[8], new ClothSimulator.ClothOBBCollider(0.25D, 0.25D, 0.13D, 0.0D, 0.3D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[9], new ClothSimulator.ClothOBBCollider(0.25D, 0.25D, 0.25D, 0.0D, 0.2D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[11], new ClothSimulator.ClothOBBCollider(0.13D, 0.24D, 0.13D, -0.0D, 0.14D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[12], new ClothSimulator.ClothOBBCollider(0.13D, 0.1875D, 0.13D, -0.0D, 0.14D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[16], new ClothSimulator.ClothOBBCollider(0.13D, 0.24D, 0.13D, 0.0D, 0.14D, 0.0D)))
|
||||
.add(Pair.of((simObject) -> simObject.getArmature().getPoseMatrices()[17], new ClothSimulator.ClothOBBCollider(0.13D, 0.1875D, 0.13D, 0.0D, 0.14D, 0.0D)))
|
||||
.build();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.cloth;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import com.tiedup.remake.rig.anim.Animator;
|
||||
import com.tiedup.remake.rig.armature.Armature;
|
||||
import yesman.epicfight.api.physics.SimulatableObject;
|
||||
|
||||
public interface ClothSimulatable extends SimulatableObject {
|
||||
@Nullable
|
||||
Armature getArmature();
|
||||
|
||||
@Nullable
|
||||
Animator getSimulatableAnimator();
|
||||
|
||||
boolean invalid();
|
||||
public Vec3 getObjectVelocity();
|
||||
public float getYRot();
|
||||
public float getYRotO();
|
||||
|
||||
// Cloth object requires providing location info for 2 steps before for accurate continuous collide detection.
|
||||
public Vec3 getAccurateCloakLocation(float partialFrame);
|
||||
public Vec3 getAccuratePartialLocation(float partialFrame);
|
||||
public float getAccurateYRot(float partialFrame);
|
||||
public float getYRotDelta(float partialFrame);
|
||||
public float getScale();
|
||||
public float getGravity();
|
||||
|
||||
ClothSimulator getClothSimulator();
|
||||
}
|
||||
1931
src/main/java/com/tiedup/remake/rig/cloth/ClothSimulator.java
Normal file
1931
src/main/java/com/tiedup/remake/rig/cloth/ClothSimulator.java
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user