diff --git a/api/src/main/java/com/fqf/mario_qua_mario/definitions/AttackInterceptingStateDefinition.java b/api/src/main/java/com/fqf/mario_qua_mario/definitions/AttackInterceptingStateDefinition.java new file mode 100644 index 0000000..7172969 --- /dev/null +++ b/api/src/main/java/com/fqf/mario_qua_mario/definitions/AttackInterceptingStateDefinition.java @@ -0,0 +1,21 @@ +package com.fqf.mario_qua_mario.definitions; + +import net.minecraft.util.Hand; +import net.minecraft.util.Identifier; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public interface AttackInterceptingStateDefinition extends MarioStateDefinition { + List getUnarmedAttackInterceptions(); + + interface AttackInterceptionDefinition { + @Nullable Identifier getActionTarget(); + @Nullable Hand getHandToSwing(); + boolean shouldTriggerAttackCooldown(); + + boolean shouldIntercept( + + ); + } +} diff --git a/api/src/main/java/com/fqf/mario_qua_mario/definitions/MarioStateDefinition.java b/api/src/main/java/com/fqf/mario_qua_mario/definitions/MarioStateDefinition.java new file mode 100644 index 0000000..ca51773 --- /dev/null +++ b/api/src/main/java/com/fqf/mario_qua_mario/definitions/MarioStateDefinition.java @@ -0,0 +1,13 @@ +package com.fqf.mario_qua_mario.definitions; + +import com.fqf.mario_qua_mario.mariodata.IMarioAuthoritativeData; +import com.fqf.mario_qua_mario.mariodata.IMarioClientData; +import net.minecraft.util.Identifier; +import org.jetbrains.annotations.NotNull; + +public interface MarioStateDefinition { + @NotNull Identifier getID(); + + void clientTick(IMarioClientData data, boolean isSelf); + void serverTick(IMarioAuthoritativeData data); +} diff --git a/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/ActionDefinition.java b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/ActionDefinition.java new file mode 100644 index 0000000..827f60b --- /dev/null +++ b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/ActionDefinition.java @@ -0,0 +1,23 @@ +package com.fqf.mario_qua_mario.definitions.actions; + +import com.fqf.mario_qua_mario.definitions.AttackInterceptingStateDefinition; +import com.fqf.mario_qua_mario.definitions.actions.util.BumpingRule; +import com.fqf.mario_qua_mario.definitions.actions.util.CameraAnimationSet; +import com.fqf.mario_qua_mario.definitions.actions.util.SneakingRule; +import net.minecraft.util.Identifier; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public interface ActionDefinition extends AttackInterceptingStateDefinition { + @Nullable String getAnimationName(); + @Nullable CameraAnimationSet getCameraAnimations(); + + @NotNull SneakingRule getSneakingRule(); + + boolean canSprint(); + + @Nullable Identifier getStompType(); + + @Nullable BumpingRule getBumpingRule(); + +} diff --git a/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/BumpingRule.java b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/BumpingRule.java new file mode 100644 index 0000000..0f702e4 --- /dev/null +++ b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/BumpingRule.java @@ -0,0 +1,41 @@ +package com.fqf.mario_qua_mario.definitions.actions.util; + +import com.fqf.mario_qua_mario.util.CharaStat; +import com.fqf.mario_qua_mario.util.StatCategory; + +public class BumpingRule { + /** + * A strength of 4 represents Super Mario being able to destroy a Brick Block, but Small Mario only bumping it. + * (Example: Ground Pound, hitting a block from below) + *

+ * A strength of 3 represents Super Mario and Small Mario both bumping a Brick Block without destroying it. + * (Example: Rolling into a wall, Bonking) + *

+ * A strength of 2 represents Super Mario being able to shatter a Flip Block, and Small Mario having no effect on it. + * (Example: Spin Jump) + *

+ * A strength of 1 represents Mario landing on a block and having no effect on it. + * (Example: Regular jump) + */ + public static final BumpingRule JUMPING = new BumpingRule(4, 1); + public static final BumpingRule FALLING = new BumpingRule(4, 1); + public static final BumpingRule SWIMMING = new BumpingRule(4, 0); + public static final BumpingRule GROUND_POUND = new BumpingRule(0, 4); + public static final BumpingRule SPIN_JUMPING = new BumpingRule(2, 2); + + public final int CEILINGS; + public final int FLOORS; + public final int WALLS; + public final CharaStat WALL_SPEED_THRESHOLD; + + public BumpingRule(int ceilingBumpStrength, int floorBumpStrength) { + this(ceilingBumpStrength, floorBumpStrength, 0, 0); + } + + public BumpingRule(int ceilingBumpStrength, int floorBumpStrength, int wallBumpStrength, double wallBumpSpeedThreshold) { + this.CEILINGS = ceilingBumpStrength; + this.FLOORS = floorBumpStrength; + this.WALLS = wallBumpStrength; + this.WALL_SPEED_THRESHOLD = new CharaStat(wallBumpSpeedThreshold, StatCategory.THRESHOLD); + } +} diff --git a/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/CameraAnimationSet.java b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/CameraAnimationSet.java new file mode 100644 index 0000000..784b53d --- /dev/null +++ b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/CameraAnimationSet.java @@ -0,0 +1,44 @@ +package com.fqf.mario_qua_mario.definitions.actions.util; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class CameraAnimationSet { + public CameraAnimationSet( + @NotNull CameraAnimation authentic, + @Nullable CameraAnimation gentle, + @Nullable CameraAnimation minimal + ) { + this.AUTHENTIC_ANIMATION = authentic; + this.GENTLE_ANIMATION = gentle == null ? authentic : gentle; + this.MINIMAL_ANIMATION = minimal; + } + + public static class CameraAnimation { + @FunctionalInterface + public interface rotationalOffsetCalculator { + void setRotationalOffsets(float progress, float[] offsets); + } + + public CameraAnimation( + boolean looping, + float durationSeconds, + CameraAnimation.rotationalOffsetCalculator calculator + ) { + this.SHOULD_LOOP = looping; + this.DURATION_TICKS = durationSeconds * 20; + this.CALCULATOR = calculator; + } + + public final boolean SHOULD_LOOP; + public final float DURATION_TICKS; + public final CameraAnimation.rotationalOffsetCalculator CALCULATOR; + } + + @NotNull + public final CameraAnimation AUTHENTIC_ANIMATION; + @NotNull + public final CameraAnimation GENTLE_ANIMATION; + @Nullable + public final CameraAnimation MINIMAL_ANIMATION; +} diff --git a/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/SlidingStatus.java b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/SlidingStatus.java new file mode 100644 index 0000000..18caa74 --- /dev/null +++ b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/SlidingStatus.java @@ -0,0 +1,10 @@ +package com.fqf.mario_qua_mario.definitions.actions.util; + +public enum SlidingStatus { + NOT_SLIDING, + NOT_SLIDING_SMOOTH, + + SLIDING, + SKIDDING, + WALL_SLIDING +} diff --git a/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/SneakingRule.java b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/SneakingRule.java new file mode 100644 index 0000000..4d21705 --- /dev/null +++ b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/SneakingRule.java @@ -0,0 +1,8 @@ +package com.fqf.mario_qua_mario.definitions.actions.util; + +public enum SneakingRule { + ALLOW, + PROHIBIT, + SLIP, + FORCE +} diff --git a/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/TransitionDefinition.java b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/TransitionDefinition.java new file mode 100644 index 0000000..f946016 --- /dev/null +++ b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/TransitionDefinition.java @@ -0,0 +1,45 @@ +package com.fqf.mario_qua_mario.definitions.actions.util; + +import com.fqf.mario_qua_mario.mariodata.IMarioClientData; +import com.fqf.mario_qua_mario.mariodata.IMarioTravelData; +import net.minecraft.util.Identifier; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class TransitionDefinition { + @FunctionalInterface + public interface Evaluator { + boolean shouldTransition(IMarioTravelData data); + } + + @FunctionalInterface + public interface TravelExecutor { + boolean execute(IMarioTravelData data); + } + + @FunctionalInterface + public interface ClientsExecutor { + boolean execute(IMarioClientData data, boolean isSelf, long seed); + } + + public TransitionDefinition( + @NotNull String targetID, + @NotNull Evaluator evaluator, + @Nullable TravelExecutor travelExecutor, + @Nullable ClientsExecutor clientsExecutor + ) { + this.TARGET_IDENTIFIER = Identifier.of(targetID); + this.EVALUATOR = evaluator; + this.TRAVEL_EXECUTOR = travelExecutor; + this.CLIENTS_EXECUTOR = clientsExecutor; + } + + public TransitionDefinition(@NotNull String targetID, @NotNull Evaluator evaluator) { + this(targetID, evaluator, null, null); + } + + public final Identifier TARGET_IDENTIFIER; + public final Evaluator EVALUATOR; + public final TravelExecutor TRAVEL_EXECUTOR; + public final ClientsExecutor CLIENTS_EXECUTOR; +} diff --git a/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/TransitionInjectionDefinition.java b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/TransitionInjectionDefinition.java new file mode 100644 index 0000000..93b1257 --- /dev/null +++ b/api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/TransitionInjectionDefinition.java @@ -0,0 +1,41 @@ +package com.fqf.mario_qua_mario.definitions.actions.util; + +import net.minecraft.util.Identifier; + +public class TransitionInjectionDefinition { + @FunctionalInterface + public interface TransitionCreator { + TransitionDefinition makeTransition(TransitionDefinition previousTransition); + } + + public enum InjectionPlacement { + BEFORE, + AFTER + } + + public enum ActionCategory { + ANY, + GROUNDED, + AIRBORNE, + AQUATIC, + WALL, + UNDEFINED + } + + public TransitionInjectionDefinition( + InjectionPlacement placement, + String injectNearTransitionsTo, + ActionCategory category, + TransitionCreator injectedTransitionCreator + ) { + this.PLACEMENT = placement; + this.INJECT_NEAR = Identifier.of(injectNearTransitionsTo); + this.INJECT_IN_CATEGORY = category; + this.TRANSITION_CREATOR = injectedTransitionCreator; + } + + public final InjectionPlacement PLACEMENT; + public final Identifier INJECT_NEAR; + public final ActionCategory INJECT_IN_CATEGORY; + public final TransitionCreator TRANSITION_CREATOR; +} diff --git a/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioAuthoritativeData.java b/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioAuthoritativeData.java index 73718ac..fba0106 100644 --- a/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioAuthoritativeData.java +++ b/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioAuthoritativeData.java @@ -1,8 +1,14 @@ package com.fqf.mario_qua_mario.mariodata; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.Identifier; -public interface IMarioAuthoritativeData { +public interface IMarioAuthoritativeData extends IMarioData { + @Override ServerPlayerEntity getMario(); + + boolean setEnabled(boolean enable); + boolean setAction(Identifier actionID); boolean setAction(String actionID); diff --git a/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioData.java b/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioData.java index 4dbb4a2..ed30040 100644 --- a/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioData.java +++ b/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioData.java @@ -11,15 +11,12 @@ public interface IMarioData { PlayerEntity getMario(); boolean isClient(); - double getStat(CharaStat stat); - double getStatMultiplier(CharaStat stat); - int getBumpStrengthModifier(); - - boolean canSneak(); - boolean canSprint(); - boolean isEnabled(); Identifier getActionID(); Identifier getPowerUpID(); Identifier getCharacterID(); + + double getStat(CharaStat stat); + double getStatMultiplier(CharaStat stat); + int getBumpStrengthModifier(); } diff --git a/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioReadableMotionData.java b/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioReadableMotionData.java new file mode 100644 index 0000000..4c8d854 --- /dev/null +++ b/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioReadableMotionData.java @@ -0,0 +1,31 @@ +package com.fqf.mario_qua_mario.mariodata; + +public interface IMarioReadableMotionData extends IMarioData { + double getForwardVel(); + double getStrafeVel(); + double getYVel(); + + MarioInputs getInputs(); + + abstract class MarioInputs { + public final MarioButton JUMP; + public final MarioButton DUCK; + public final MarioButton SPIN; + + public abstract double getForwardInput(); + public abstract double getStrafeInput(); + + public abstract boolean isReal(); + + public interface MarioButton { + boolean isPressed(); + boolean isHeld(); + } + + protected MarioInputs(MarioButton jump, MarioButton duck, MarioButton spin) { + JUMP = jump; + DUCK = duck; + SPIN = spin; + } + } +} diff --git a/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioTravelData.java b/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioTravelData.java index b615305..64d74cb 100644 --- a/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioTravelData.java +++ b/api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioTravelData.java @@ -1,10 +1,6 @@ package com.fqf.mario_qua_mario.mariodata; -public interface IMarioTravelData extends IMarioData { - double getForwardVel(); - double getStrafeVel(); - double getYVel(); - +public interface IMarioTravelData extends IMarioReadableMotionData { void setForwardVel(double forward); void setStrafeVel(double strafe); default void setForwardStrafeVel(double forward, double strafe) { @@ -12,26 +8,4 @@ default void setForwardStrafeVel(double forward, double strafe) { this.setStrafeVel(strafe); } void setYVel(double vertical); - - abstract class MarioInputs { - public final MarioButton JUMP; - public final MarioButton DUCK; - public final MarioButton SPIN; - - public abstract double getForwardInput(); - public abstract double getStrafeInput(); - - public abstract boolean isReal(); - - public interface MarioButton { - boolean isPressed(); - boolean isHeld(); - } - - protected MarioInputs(MarioButton jump, MarioButton duck, MarioButton spin) { - JUMP = jump; - DUCK = duck; - SPIN = spin; - } - } } diff --git a/mod/src/client/java/com/fqf/mario_qua_mario/mariodata/MarioMainClientData.java b/mod/src/client/java/com/fqf/mario_qua_mario/mariodata/MarioMainClientData.java index d7272db..7916fb3 100644 --- a/mod/src/client/java/com/fqf/mario_qua_mario/mariodata/MarioMainClientData.java +++ b/mod/src/client/java/com/fqf/mario_qua_mario/mariodata/MarioMainClientData.java @@ -15,17 +15,19 @@ public static void clearInstance() { private ClientPlayerEntity mario; public MarioMainClientData(ClientPlayerEntity mario) { + super(); this.mario = mario; instance = this; } - - @Override - public ClientPlayerEntity getMario() { + @Override public ClientPlayerEntity getMario() { return mario; } + @Override public void setMario(PlayerEntity mario) { + this.mario = (ClientPlayerEntity) mario; + } @Override - public void setMario(PlayerEntity mario) { - this.mario = (ClientPlayerEntity) mario; + public void tick() { + } } diff --git a/mod/src/client/java/com/fqf/mario_qua_mario/mariodata/MarioOtherClientData.java b/mod/src/client/java/com/fqf/mario_qua_mario/mariodata/MarioOtherClientData.java index 1c23f58..4f3ad5f 100644 --- a/mod/src/client/java/com/fqf/mario_qua_mario/mariodata/MarioOtherClientData.java +++ b/mod/src/client/java/com/fqf/mario_qua_mario/mariodata/MarioOtherClientData.java @@ -6,16 +6,18 @@ public class MarioOtherClientData extends MarioPlayerData implements IMarioClientDataImpl { private OtherClientPlayerEntity mario; public MarioOtherClientData(OtherClientPlayerEntity mario) { + super(); this.mario = mario; } - - @Override - public void setMario(PlayerEntity mario) { + @Override public OtherClientPlayerEntity getMario() { + return this.mario; + } + @Override public void setMario(PlayerEntity mario) { this.mario = (OtherClientPlayerEntity) mario; } @Override - public OtherClientPlayerEntity getMario() { - return this.mario; + public void tick() { + } } diff --git a/mod/src/main/java/com/fqf/mario_qua_mario/mariodata/MarioPlayerData.java b/mod/src/main/java/com/fqf/mario_qua_mario/mariodata/MarioPlayerData.java index 14c6c8b..7841bb4 100644 --- a/mod/src/main/java/com/fqf/mario_qua_mario/mariodata/MarioPlayerData.java +++ b/mod/src/main/java/com/fqf/mario_qua_mario/mariodata/MarioPlayerData.java @@ -1,6 +1,9 @@ package com.fqf.mario_qua_mario.mariodata; +import com.fqf.mario_qua_mario.MarioQuaMario; +import com.fqf.mario_qua_mario.registries.actions.ParsedAction; import com.fqf.mario_qua_mario.util.CharaStat; +import net.minecraft.entity.attribute.EntityAttributeModifier; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.Identifier; @@ -8,50 +11,61 @@ * The most advanced form of MarioData that can be applied for all players. */ public abstract class MarioPlayerData implements IMarioData { - public abstract void setMario(PlayerEntity mario); - - @Override - public double getStat(CharaStat stat) { - return 0; + protected MarioPlayerData() { + this.enabled = false; + this.action = null; +// this.powerUp = null; +// this.character = null; } - @Override - public double getStatMultiplier(CharaStat stat) { - return 0; - } + private boolean enabled; + private static final Identifier FALL_RESISTANCE_ID = Identifier.of(MarioQuaMario.MOD_ID, "mario_fall_resistance"); + private static final EntityAttributeModifier FALL_RESISTANCE = new EntityAttributeModifier( + FALL_RESISTANCE_ID, 8, EntityAttributeModifier.Operation.ADD_VALUE + ); - @Override - public int getBumpStrengthModifier() { - return 0; + private static final Identifier ATTACK_SLOWDOWN_ID = Identifier.of(MarioQuaMario.MOD_ID, "mario_fall_resistance"); + private static final EntityAttributeModifier ATTACK_SLOWDOWN = new EntityAttributeModifier( + ATTACK_SLOWDOWN_ID, -0.5, EntityAttributeModifier.Operation.ADD_MULTIPLIED_TOTAL + ); + @Override public boolean isEnabled() { + return this.enabled; } - - @Override - public boolean canSneak() { - return false; + public void setEnabledInternal(boolean enabled) { + this.enabled = enabled; } - @Override - public boolean canSprint() { - return false; + private ParsedAction action; + @Override public Identifier getActionID() { + return null; } - - @Override - public boolean isEnabled() { - return false; + public ParsedAction getAction() { + return this.action; + } + public void setActionInternal(ParsedAction action) { + this.action = action; } - @Override - public Identifier getActionID() { + @Override public Identifier getPowerUpID() { return null; } - @Override - public Identifier getPowerUpID() { + @Override public Identifier getCharacterID() { return null; } - @Override - public Identifier getCharacterID() { - return null; + public abstract void setMario(PlayerEntity mario); + public abstract void tick(); + + @Override public double getStat(CharaStat stat) { + return stat.BASE * this.getStatMultiplier(stat); + } + + @Override public double getStatMultiplier(CharaStat stat) { + return 0; + } + + @Override public int getBumpStrengthModifier() { + return 0; } } diff --git a/mod/src/main/java/com/fqf/mario_qua_mario/mariodata/MarioServerPlayerData.java b/mod/src/main/java/com/fqf/mario_qua_mario/mariodata/MarioServerPlayerData.java index 64ca5bb..460a680 100644 --- a/mod/src/main/java/com/fqf/mario_qua_mario/mariodata/MarioServerPlayerData.java +++ b/mod/src/main/java/com/fqf/mario_qua_mario/mariodata/MarioServerPlayerData.java @@ -1,4 +1,66 @@ package com.fqf.mario_qua_mario.mariodata; -public class MarioServerPlayerData extends MarioPlayerData { +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.util.Identifier; + +public class MarioServerPlayerData extends MarioPlayerData implements IMarioAuthoritativeData { + private ServerPlayerEntity mario; + public MarioServerPlayerData(ServerPlayerEntity mario) { + super(); + this.mario = mario; + } + @Override public ServerPlayerEntity getMario() { + return this.mario; + } + + @Override public boolean setEnabled(boolean enable) { + return false; + } + + @Override public boolean setAction(Identifier actionID) { + return false; + } + + @Override public boolean setAction(String actionID) { + return false; + } + + @Override public boolean setActionTransitionless(Identifier actionID) { + return false; + } + + @Override public boolean setActionTransitionless(String actionID) { + return false; + } + + @Override public boolean setPowerUp(Identifier powerUpID) { + return false; + } + + @Override public boolean setPowerUp(String powerUpID) { + return false; + } + + @Override public boolean setCharacter(Identifier characterID) { + return false; + } + + @Override public boolean setCharacter(String characterID) { + return false; + } + + @Override public void setMario(PlayerEntity mario) { + this.mario = (ServerPlayerEntity) mario; + } + + @Override + public boolean isClient() { + return false; + } + + @Override + public void tick() { + + } } diff --git a/mod/src/main/java/com/fqf/mario_qua_mario/mixin/ServerPlayerMarioDataMixin.java b/mod/src/main/java/com/fqf/mario_qua_mario/mixin/ServerPlayerMarioDataMixin.java index 976da40..71bcdb0 100644 --- a/mod/src/main/java/com/fqf/mario_qua_mario/mixin/ServerPlayerMarioDataMixin.java +++ b/mod/src/main/java/com/fqf/mario_qua_mario/mixin/ServerPlayerMarioDataMixin.java @@ -24,7 +24,7 @@ public abstract class ServerPlayerMarioDataMixin extends PlayerEntityMarioDataMi @Inject(method = "", at = @At("RETURN")) private void constructorHook(MinecraftServer server, ServerWorld world, GameProfile profile, SyncedClientOptions clientOptions, CallbackInfo ci) { - this.mqm$setMarioData(new MarioServerPlayerData()); + this.mqm$setMarioData(new MarioServerPlayerData((ServerPlayerEntity) (Object) this)); } @Override public void mqm$setMarioData(MarioPlayerData replacementData) { diff --git a/mod/src/main/java/com/fqf/mario_qua_mario/registries/RegistryManager.java b/mod/src/main/java/com/fqf/mario_qua_mario/registries/RegistryManager.java index abedad8..cc9b5e9 100644 --- a/mod/src/main/java/com/fqf/mario_qua_mario/registries/RegistryManager.java +++ b/mod/src/main/java/com/fqf/mario_qua_mario/registries/RegistryManager.java @@ -1,6 +1,7 @@ package com.fqf.mario_qua_mario.registries; import com.fqf.mario_qua_mario.MarioQuaMario; +import com.fqf.mario_qua_mario.registries.actions.ParsedAction; import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder; import net.fabricmc.fabric.api.event.registry.RegistryAttribute; import net.fabricmc.loader.api.FabricLoader; @@ -16,9 +17,6 @@ public static void register() { Registry.register(STOMP_TYPES, Identifier.of(MarioQuaMario.MOD_ID, "stomp"), "BOING!"); Registry.register(STOMP_TYPES, Identifier.of(MarioQuaMario.MOD_ID, "ground_pound"), "POW!"); - Registry.register(ACTIONS, Identifier.of(MarioQuaMario.MOD_ID, "debug"), "float..."); - Registry.register(ACTIONS, Identifier.of(MarioQuaMario.MOD_ID, "debug_alt"), "zoom!"); - Registry.register(POWER_UPS, Identifier.of(MarioQuaMario.MOD_ID, "super"), "wahoo!"); Registry.register(POWER_UPS, Identifier.of(MarioQuaMario.MOD_ID, "small"), "owch!"); @@ -32,9 +30,9 @@ public static void register() { .attribute(RegistryAttribute.SYNCED) .buildAndRegister(); - public static final RegistryKey> ACTIONS_KEY = RegistryKey.ofRegistry( + public static final RegistryKey> ACTIONS_KEY = RegistryKey.ofRegistry( Identifier.of(MarioQuaMario.MOD_ID, "actions")); - public static final Registry ACTIONS = FabricRegistryBuilder.createSimple(ACTIONS_KEY) + public static final Registry ACTIONS = FabricRegistryBuilder.createSimple(ACTIONS_KEY) .attribute(RegistryAttribute.SYNCED) .buildAndRegister(); @@ -54,5 +52,19 @@ public static List getEntrypoints(String key, Class clazz) { return FabricLoader.getInstance().getEntrypointContainers(key, clazz).stream().map(EntrypointContainer::getEntrypoint).toList(); } + private static void registerStompTypes() { + + } + + private static void registerActions() { + + } + private static void registerPowerUps() { + + } + + private static void registerCharacters() { + + } } diff --git a/mod/src/main/java/com/fqf/mario_qua_mario/registries/actions/InitAction.java b/mod/src/main/java/com/fqf/mario_qua_mario/registries/actions/InitAction.java new file mode 100644 index 0000000..ef7ecb0 --- /dev/null +++ b/mod/src/main/java/com/fqf/mario_qua_mario/registries/actions/InitAction.java @@ -0,0 +1,4 @@ +package com.fqf.mario_qua_mario.registries.actions; + +public class InitAction { +} diff --git a/mod/src/main/java/com/fqf/mario_qua_mario/registries/actions/ParsedAction.java b/mod/src/main/java/com/fqf/mario_qua_mario/registries/actions/ParsedAction.java new file mode 100644 index 0000000..da428a4 --- /dev/null +++ b/mod/src/main/java/com/fqf/mario_qua_mario/registries/actions/ParsedAction.java @@ -0,0 +1,12 @@ +package com.fqf.mario_qua_mario.registries.actions; + +import com.fqf.mario_qua_mario.definitions.actions.ActionDefinition; + +public class ParsedAction { + private final ActionDefinition DEFINITION; +// private final Identifier ID; + + public ParsedAction(ActionDefinition definition) { + this.DEFINITION = definition; + } +} diff --git a/mod/src/main/java/com/fqf/mario_qua_mario/registries/actions/ParsedTransition.java b/mod/src/main/java/com/fqf/mario_qua_mario/registries/actions/ParsedTransition.java new file mode 100644 index 0000000..610e4f3 --- /dev/null +++ b/mod/src/main/java/com/fqf/mario_qua_mario/registries/actions/ParsedTransition.java @@ -0,0 +1,22 @@ +package com.fqf.mario_qua_mario.registries.actions; + +import com.fqf.mario_qua_mario.definitions.actions.util.TransitionDefinition; +import com.fqf.mario_qua_mario.registries.RegistryManager; + +public class ParsedTransition { + public final ParsedAction TARGET; + public final TransitionDefinition.Evaluator EVALUATOR; + public final TransitionDefinition.TravelExecutor TRAVEL_EXECUTOR; + public final TransitionDefinition.ClientsExecutor CLIENTS_EXECUTOR; + + public final int INDEX; + + public ParsedTransition(TransitionDefinition definition, int index) { + this.TARGET = RegistryManager.ACTIONS.get(definition.TARGET_IDENTIFIER); + this.EVALUATOR = definition.EVALUATOR; + this.TRAVEL_EXECUTOR = definition.TRAVEL_EXECUTOR; + this.CLIENTS_EXECUTOR = definition.CLIENTS_EXECUTOR; + + this.INDEX = index; + } +}