diff --git a/api/src/main/java/com/floralquafloral/definitions/CharacterDefinition.java b/api/src/main/java/com/floralquafloral/definitions/CharacterDefinition.java index 4d05556..c532873 100644 --- a/api/src/main/java/com/floralquafloral/definitions/CharacterDefinition.java +++ b/api/src/main/java/com/floralquafloral/definitions/CharacterDefinition.java @@ -4,6 +4,6 @@ import java.util.Map; -public interface CharacterDefinition extends MarioMajorStateDefinition { +public interface CharacterDefinition extends MarioStatAlteringStateDefinition { @NotNull Map getPoweredUpPlayermodels(); } diff --git a/api/src/main/java/com/floralquafloral/definitions/MarioAttackInterceptingStateDefinition.java b/api/src/main/java/com/floralquafloral/definitions/MarioAttackInterceptingStateDefinition.java new file mode 100644 index 0000000..cb6ee0d --- /dev/null +++ b/api/src/main/java/com/floralquafloral/definitions/MarioAttackInterceptingStateDefinition.java @@ -0,0 +1,15 @@ +package com.floralquafloral.definitions; + +import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; +import com.floralquafloral.mariodata.MarioTravelData; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.BlockPos; +import org.jetbrains.annotations.Nullable; + +public interface MarioAttackInterceptingStateDefinition extends MarioStateDefinition { + boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ); +} diff --git a/api/src/main/java/com/floralquafloral/definitions/MarioMajorStateDefinition.java b/api/src/main/java/com/floralquafloral/definitions/MarioStatAlteringStateDefinition.java similarity index 79% rename from api/src/main/java/com/floralquafloral/definitions/MarioMajorStateDefinition.java rename to api/src/main/java/com/floralquafloral/definitions/MarioStatAlteringStateDefinition.java index 848d16f..04f038c 100644 --- a/api/src/main/java/com/floralquafloral/definitions/MarioMajorStateDefinition.java +++ b/api/src/main/java/com/floralquafloral/definitions/MarioStatAlteringStateDefinition.java @@ -5,7 +5,7 @@ import java.util.Map; import java.util.Set; -public interface MarioMajorStateDefinition extends MarioStateDefinition { +public interface MarioStatAlteringStateDefinition extends MarioStateDefinition { void populateStatModifiers(Map, Double> modifiers); int getBumpStrengthModifier(); diff --git a/api/src/main/java/com/floralquafloral/definitions/PowerUpDefinition.java b/api/src/main/java/com/floralquafloral/definitions/PowerUpDefinition.java index 6f2dcb1..7c23b7f 100644 --- a/api/src/main/java/com/floralquafloral/definitions/PowerUpDefinition.java +++ b/api/src/main/java/com/floralquafloral/definitions/PowerUpDefinition.java @@ -8,7 +8,7 @@ import java.util.Map; -public interface PowerUpDefinition extends MarioMajorStateDefinition { +public interface PowerUpDefinition extends MarioStatAlteringStateDefinition, MarioAttackInterceptingStateDefinition { @NotNull Map getCharacterPlayermodels(); void acquirePower(MarioData data); diff --git a/api/src/main/java/com/floralquafloral/definitions/actions/ActionDefinition.java b/api/src/main/java/com/floralquafloral/definitions/actions/ActionDefinition.java index 94f7652..a2053f1 100644 --- a/api/src/main/java/com/floralquafloral/definitions/actions/ActionDefinition.java +++ b/api/src/main/java/com/floralquafloral/definitions/actions/ActionDefinition.java @@ -1,5 +1,6 @@ package com.floralquafloral.definitions.actions; +import com.floralquafloral.definitions.MarioAttackInterceptingStateDefinition; import com.floralquafloral.mariodata.MarioClientSideData; import com.floralquafloral.definitions.MarioStateDefinition; import com.floralquafloral.mariodata.MarioData; @@ -11,7 +12,7 @@ import java.util.List; -public interface ActionDefinition extends MarioStateDefinition { +public interface ActionDefinition extends MarioStateDefinition, MarioAttackInterceptingStateDefinition { @Nullable String getAnimationName(); @Nullable CameraAnimationSet getCameraAnimations(); diff --git a/api/src/main/java/com/floralquafloral/definitions/actions/AirborneActionDefinition.java b/api/src/main/java/com/floralquafloral/definitions/actions/AirborneActionDefinition.java index 582ffc1..1b54edd 100644 --- a/api/src/main/java/com/floralquafloral/definitions/actions/AirborneActionDefinition.java +++ b/api/src/main/java/com/floralquafloral/definitions/actions/AirborneActionDefinition.java @@ -29,13 +29,13 @@ public static ActionTransitionDefinition makeJumpCapTransition(ActionDefinition public static final ActionTransitionDefinition DOUBLE_JUMPABLE_LANDING = new ActionTransitionDefinition( "qua_mario:basic", BASIC_LANDING.EVALUATOR, - data -> data.getTimers().jumpLandingTime = 5, + data -> data.getTimers().jumpLandingTime = 3, null ); public static final ActionTransitionDefinition TRIPLE_JUMPABLE_LANDING = new ActionTransitionDefinition( "qua_mario:basic", BASIC_LANDING.EVALUATOR, - data -> data.getTimers().doubleJumpLandingTime = 5, + data -> data.getTimers().doubleJumpLandingTime = 3, null ); diff --git a/api/src/main/java/com/floralquafloral/definitions/actions/AquaticActionDefinition.java b/api/src/main/java/com/floralquafloral/definitions/actions/AquaticActionDefinition.java index 85353b1..2877c72 100644 --- a/api/src/main/java/com/floralquafloral/definitions/actions/AquaticActionDefinition.java +++ b/api/src/main/java/com/floralquafloral/definitions/actions/AquaticActionDefinition.java @@ -48,7 +48,7 @@ public abstract static class AquaticStats { public static final CharaStat BACKWARD_SWIM_ACCEL = new CharaStat(0.035, SWIMMING, BACKWARD, ACCELERATION); public static final CharaStat BACKWARD_SWIM_SPEED = new CharaStat(0.2, SWIMMING, BACKWARD, SPEED); - public static final CharaStat STRAFE_SWIM_ACCEL = new CharaStat(0.055, SWIMMING, STRAFE, ACCELERATION); + public static final CharaStat STRAFE_SWIM_ACCEL = new CharaStat(0.025, SWIMMING, STRAFE, ACCELERATION); public static final CharaStat STRAFE_SWIM_SPEED = new CharaStat(0.25, SWIMMING, STRAFE, SPEED); public static final CharaStat SWIM_REDIRECTION = new CharaStat(2.0, SWIMMING, REDIRECTION); diff --git a/api/src/main/java/com/floralquafloral/mariodata/MarioClientSideData.java b/api/src/main/java/com/floralquafloral/mariodata/MarioClientSideData.java index 6c1629c..1a54c94 100644 --- a/api/src/main/java/com/floralquafloral/mariodata/MarioClientSideData.java +++ b/api/src/main/java/com/floralquafloral/mariodata/MarioClientSideData.java @@ -27,6 +27,9 @@ PositionedSoundInstance playSoundEvent( PositionedSoundInstance voice(VoiceLine line, long seed); float getVoicePitch(); + void storeSound(PositionedSoundInstance instance); + void stopStoredSound(SoundEvent event); + enum VoiceLine { SELECT, DUCK, diff --git a/api/src/main/java/com/floralquafloral/mariodata/MarioTravelData.java b/api/src/main/java/com/floralquafloral/mariodata/MarioTravelData.java index daa4752..c192e43 100644 --- a/api/src/main/java/com/floralquafloral/mariodata/MarioTravelData.java +++ b/api/src/main/java/com/floralquafloral/mariodata/MarioTravelData.java @@ -55,5 +55,7 @@ class MarioTimers { public int doubleJumpLandingTime = 0; public boolean jumpCapped = false; + + public boolean actionInterceptedAttack = false; } } diff --git a/mod/src/main/java/com/floralquafloral/MarioQuaMario.java b/mod/src/main/java/com/floralquafloral/MarioQuaMario.java index 387858e..b0f97bb 100644 --- a/mod/src/main/java/com/floralquafloral/MarioQuaMario.java +++ b/mod/src/main/java/com/floralquafloral/MarioQuaMario.java @@ -19,7 +19,10 @@ import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes; import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.damage.DamageType; +import net.minecraft.entity.damage.DamageTypes; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; import net.minecraft.particle.SimpleParticleType; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.sound.SoundCategory; @@ -81,6 +84,16 @@ public void onInitialize() { MarioCommand.registerMarioCommand(); +// ServerLivingEntityEvents.ALLOW_DAMAGE.register((livingEntity, damageSource, amount) -> { +// if(damageSource.isDirect() && damageSource.isOf(DamageTypes.PLAYER_ATTACK) && damageSource.getAttacker() instanceof PlayerEntity player) { +// ItemStack weapon = damageSource.getWeaponStack(); +// if(weapon != null && weapon.isEmpty()) { +// // Unarmed player attack +// } +// } +// return true; +// }); + // Mario can't be damaged by a mob that he's high enough to stomp on ServerLivingEntityEvents.ALLOW_DAMAGE.register((livingEntity, damageSource, amount) -> { if(livingEntity instanceof PlayerEntity player && damageSource.getSource() instanceof LivingEntity sourceEntity && sourceEntity.equals(damageSource.getAttacker())) { diff --git a/mod/src/main/java/com/floralquafloral/mariodata/MarioClientSideDataImplementation.java b/mod/src/main/java/com/floralquafloral/mariodata/MarioClientSideDataImplementation.java index 338fd0c..8f4d225 100644 --- a/mod/src/main/java/com/floralquafloral/mariodata/MarioClientSideDataImplementation.java +++ b/mod/src/main/java/com/floralquafloral/mariodata/MarioClientSideDataImplementation.java @@ -100,6 +100,17 @@ default PositionedSoundInstance voice(MarioClientSideData.VoiceLine line, long s JumpSoundPlayer.fadeJumpSfx(this); } + Map STORED_SOUNDS = new HashMap<>(); + + @Override default void storeSound(PositionedSoundInstance instance) { + STORED_SOUNDS.put(instance.getId(), instance); + } + + @Override + default void stopStoredSound(SoundEvent event) { + MinecraftClient.getInstance().getSoundManager().stop(STORED_SOUNDS.get(event.getId())); + } + EnumMap> VOICE_SOUND_EVENTS = new EnumMap<>(VoiceLine.class); class VoiceSoundEventInitializer { public static void initialize() { diff --git a/mod/src/main/java/com/floralquafloral/mariodata/MarioPlayerData.java b/mod/src/main/java/com/floralquafloral/mariodata/MarioPlayerData.java index c43f7c4..987799c 100644 --- a/mod/src/main/java/com/floralquafloral/mariodata/MarioPlayerData.java +++ b/mod/src/main/java/com/floralquafloral/mariodata/MarioPlayerData.java @@ -253,7 +253,7 @@ public void setPowerUp(ParsedPowerUp powerUp) { MarioQuaMario.LOGGER.info("Set Power-up to {}", powerUp.ID); this.powerUp.losePower(this); powerUp.acquirePower(this); - this.mario.setHealth(this.mario.getMaxHealth()); + this.mario.heal(this.mario.getMaxHealth()); this.powerUp = powerUp; this.mario.calculateDimensions(); } diff --git a/mod/src/main/java/com/floralquafloral/mariodata/moveable/MarioMainClientData.java b/mod/src/main/java/com/floralquafloral/mariodata/moveable/MarioMainClientData.java index c431326..75f7b7e 100644 --- a/mod/src/main/java/com/floralquafloral/mariodata/moveable/MarioMainClientData.java +++ b/mod/src/main/java/com/floralquafloral/mariodata/moveable/MarioMainClientData.java @@ -55,7 +55,7 @@ public void setAction(ParsedAction action, long seed) { public final float[] CAMERA_ROTATIONS = new float[3]; @Override public void setActionTransitionless(ParsedAction action) { -// MarioQuaMario.LOGGER.info("MarioMainClientData setAction to " + action.ID); + MarioQuaMario.LOGGER.info("MarioMainClientData setAction to " + action.ID); if(action != getAction()) getTimers().actionTimer = 0; // CPM animation @@ -103,9 +103,6 @@ public void setAction(ParsedAction action, long seed) { getAction().travelHook(this); getAction().attemptTransitions(this, TransitionPhase.INPUT); - getTimers().jumpLandingTime--; - getTimers().doubleJumpLandingTime--; - applyModifiedVelocity(); marioClient.move(MovementType.SELF, marioClient.getVelocity()); @@ -137,6 +134,10 @@ public void setAction(ParsedAction action, long seed) { applyModifiedVelocity(); + getTimers().jumpLandingTime--; + getTimers().doubleJumpLandingTime--; + getTimers().actionInterceptedAttack = false; + marioClient.updateLimbs(false); return !marioClient.hasVehicle(); } diff --git a/mod/src/main/java/com/floralquafloral/mixin/PlayerEntityMixin.java b/mod/src/main/java/com/floralquafloral/mixin/PlayerEntityMixin.java index bb5008b..019cbba 100644 --- a/mod/src/main/java/com/floralquafloral/mixin/PlayerEntityMixin.java +++ b/mod/src/main/java/com/floralquafloral/mixin/PlayerEntityMixin.java @@ -1,10 +1,15 @@ package com.floralquafloral.mixin; +import com.floralquafloral.MarioQuaMario; +import com.floralquafloral.mariodata.MarioClientSideData; import com.floralquafloral.mariodata.MarioDataManager; import com.floralquafloral.mariodata.MarioPlayerData; +import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.mariodata.moveable.MarioMoveableData; +import com.floralquafloral.mariodata.moveable.MarioServerData; import com.floralquafloral.registries.states.character.ParsedCharacter; import com.floralquafloral.registries.states.powerup.ParsedPowerUp; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityDimensions; import net.minecraft.entity.EntityPose; import net.minecraft.entity.player.PlayerEntity; @@ -95,4 +100,23 @@ public void changeDismounting(CallbackInfoReturnable cir) { if(data.attemptDismount) data.attemptDismount = false; } } + +// @Inject(method = "attack", at = @At("HEAD"), cancellable = true) +// public void interceptUnarmedAttacks(Entity target, CallbackInfo ci) { +// PlayerEntity player = (PlayerEntity) (Object) this; +// if(!target.isAttackable() || target.handleAttack(player)) return; +// +// if(player.isUsingRiptide() || !player.getWeaponStack().isEmpty()) return; +// +// MarioPlayerData data = MarioDataManager.getMarioData(player); +// if(data.getAction().interceptAttack( +// data, +// data instanceof MarioClientSideData clientData ? clientData : null, +// data instanceof MarioTravelData travelData ? travelData : null, +// target, null +// )) ci.cancel(); +// +// MarioQuaMario.LOGGER.info("Intercepted unarmed attack!!!"); +// ci.cancel(); +// } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/ParsedMajorMarioState.java b/mod/src/main/java/com/floralquafloral/registries/states/ParsedMajorMarioState.java index 7072dca..cd9b406 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/ParsedMajorMarioState.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/ParsedMajorMarioState.java @@ -1,7 +1,7 @@ package com.floralquafloral.registries.states; import com.floralquafloral.definitions.actions.CharaStat; -import com.floralquafloral.definitions.MarioMajorStateDefinition; +import com.floralquafloral.definitions.MarioStatAlteringStateDefinition; import com.floralquafloral.definitions.actions.StatCategory; import java.util.HashMap; @@ -29,7 +29,7 @@ public double getStatMultiplier(CharaStat stat) { return combinedModifier; } - protected ParsedMajorMarioState(MarioMajorStateDefinition definition) { + protected ParsedMajorMarioState(MarioStatAlteringStateDefinition definition) { super(definition); this.BUMP_STRENGTH_MODIFIER = definition.getBumpStrengthModifier(); diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/ParsedAction.java b/mod/src/main/java/com/floralquafloral/registries/states/action/ParsedAction.java index d18608c..5261771 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/ParsedAction.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/ParsedAction.java @@ -11,8 +11,10 @@ import com.floralquafloral.registries.RegistryManager; import com.floralquafloral.registries.stomp.ParsedStomp; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.random.RandomSeed; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.*; @@ -169,4 +171,11 @@ private void execute(MarioData data, long seed) { this.EXECUTOR_CLIENTS.execute(clientData, data.getMario().isMainPlayer(), seed); } } + + public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return this.ACTION_DEFINITION.interceptAttack(data, clientData, travelData, entityTarget, blockTarget); + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/ActionDebug.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/ActionDebug.java index dd1710f..de832bb 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/ActionDebug.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/ActionDebug.java @@ -3,11 +3,14 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.ActionDefinition; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -82,4 +85,11 @@ public List getWorldCollisionTransitions() { public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/ActionDebugAlt.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/ActionDebugAlt.java index 71dd2dd..cccd658 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/ActionDebugAlt.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/ActionDebugAlt.java @@ -3,12 +3,15 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.ActionDefinition; import net.minecraft.sound.SoundEvents; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -83,4 +86,11 @@ public List getWorldCollisionTransitions() { public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/AquaticGroundPoundWindup.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/AquaticGroundPoundWindup.java index f5c593b..f670794 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/AquaticGroundPoundWindup.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/AquaticGroundPoundWindup.java @@ -2,11 +2,16 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.definitions.actions.AirborneActionDefinition; +import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; +import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.registries.states.action.baseactions.airborne.GroundPound; import com.floralquafloral.util.MarioSFX; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -22,7 +27,7 @@ public class AquaticGroundPoundWindup extends GroundPoundWindup { @Override public @Nullable CameraAnimationSet getCameraAnimations() { return new CameraAnimationSet( new CameraAnimation( - false, 0.55F, + false, 0.45F, (progress, offsets) -> offsets[1] = mixedEase(progress, SINE, CUBIC) * 360 ), null, @@ -34,15 +39,15 @@ public class AquaticGroundPoundWindup extends GroundPoundWindup { return List.of( new ActionTransitionDefinition("qua_mario:aquatic_ground_pound", data -> AirborneActionDefinition.AerialTransitions.ENTER_WATER.EVALUATOR.shouldTransition(data) - && data.getTimers().actionTimer > 9, + && data.getTimers().actionTimer > 7, data -> { data.setYVel(GroundPound.GROUND_POUND_VEL.get(data)); data.getInputs().JUMP.isPressed(); // Unbuffers jump }, - (data, isSelf, seed) -> data.playSoundEvent(MarioSFX.DIVE, seed) + (data, isSelf, seed) -> data.storeSound(data.playSoundEvent(MarioSFX.DIVE, seed)) ), new ActionTransitionDefinition("qua_mario:ground_pound", - data -> data.getTimers().actionTimer > 9, + data -> data.getTimers().actionTimer > 7, data -> { data.setYVel(GroundPound.GROUND_POUND_VEL.get(data)); data.getInputs().JUMP.isPressed(); // Unbuffers jump @@ -50,4 +55,11 @@ public class AquaticGroundPoundWindup extends GroundPoundWindup { ) ); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/GroundPoundWindup.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/GroundPoundWindup.java index affceaf..3347bce 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/GroundPoundWindup.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/GroundPoundWindup.java @@ -4,12 +4,15 @@ import com.floralquafloral.definitions.actions.AirborneActionDefinition; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.ActionDefinition; import com.floralquafloral.registries.states.action.baseactions.airborne.GroundPound; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -96,4 +99,11 @@ public List getWorldCollisionTransitions() { public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/Mounted.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/Mounted.java index 7b843e0..c14d2d2 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/Mounted.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/Mounted.java @@ -1,16 +1,15 @@ package com.floralquafloral.registries.states.action.baseactions; import com.floralquafloral.MarioQuaMario; -import com.floralquafloral.mariodata.MarioAuthoritativeData; -import com.floralquafloral.mariodata.MarioClientSideData; -import com.floralquafloral.mariodata.MarioPlayerData; -import com.floralquafloral.mariodata.MarioTravelData; +import com.floralquafloral.mariodata.*; import com.floralquafloral.definitions.actions.ActionDefinition; import com.floralquafloral.definitions.actions.GroundedActionDefinition; import com.floralquafloral.registries.states.action.baseactions.grounded.DuckWaddle; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -99,4 +98,11 @@ public List getWorldCollisionTransitions() { public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/DoubleJump.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/DoubleJump.java index 61cddfa..8c894f2 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/DoubleJump.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/DoubleJump.java @@ -45,10 +45,9 @@ private ActionTransitionInjection makeInjectionFrom(String otherAction) { otherAction, ActionTransitionInjection.ActionCategory.GROUNDED, new ActionTransitionDefinition("qua_mario:double_jump", - data -> - data.getTimers().jumpLandingTime > 0 - && data.getForwardVel() > DOUBLE_JUMP_SPEED_THRESHOLD.get(data) - && GroundedActionDefinition.GroundedTransitions.JUMP.EVALUATOR.shouldTransition(data), + data -> data.getTimers().jumpLandingTime > 0 + && data.getForwardVel() >= DOUBLE_JUMP_SPEED_THRESHOLD.get(data) + && GroundedActionDefinition.GroundedTransitions.JUMP.EVALUATOR.shouldTransition(data), data -> GroundedActionDefinition.GroundedTransitions.performJump(data, DOUBLE_JUMP_VEL, DOUBLE_JUMP_VEL_ADDEND), (data, isSelf, seed) -> { data.playJumpSound(seed); diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/DuckFall.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/DuckFall.java index 274e747..d07b986 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/DuckFall.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/DuckFall.java @@ -1,9 +1,15 @@ package com.floralquafloral.registries.states.action.baseactions.airborne; import com.floralquafloral.MarioQuaMario; +import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; +import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.registries.states.action.baseactions.grounded.DuckWaddle; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -34,4 +40,11 @@ public class DuckFall extends Fall { AerialTransitions.DUCKING_LANDING ); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/DuckJump.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/DuckJump.java index 8fbd988..6ea6a82 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/DuckJump.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/DuckJump.java @@ -1,9 +1,15 @@ package com.floralquafloral.registries.states.action.baseactions.airborne; import com.floralquafloral.MarioQuaMario; +import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; +import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.registries.states.action.baseactions.grounded.DuckWaddle; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -37,4 +43,11 @@ public List getWorldCollisionTransitions() { AerialTransitions.DUCKING_LANDING ); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/Fall.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/Fall.java index 06ca958..ff92a44 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/Fall.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/Fall.java @@ -3,12 +3,15 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.AirborneActionDefinition; import com.floralquafloral.definitions.actions.CharaStat; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -78,4 +81,22 @@ public class Fall extends AirborneActionDefinition { @Override public List getTransitionInjections() { return List.of(); } + + public static boolean attemptKick( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { +// if(travelData != null && travelData.getYVel() < 0) { +// travelData.setYVel(0.4); +// return true; +// } + return false; + } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return attemptKick(data, clientData, travelData, entityTarget, blockTarget); + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/GroundPound.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/GroundPound.java index 120eb35..07a4f16 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/GroundPound.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/GroundPound.java @@ -3,14 +3,17 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.AirborneActionDefinition; import com.floralquafloral.definitions.actions.CharaStat; import com.floralquafloral.definitions.actions.StatCategory; import com.floralquafloral.util.MarioSFX; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -101,4 +104,11 @@ public class GroundPound extends AirborneActionDefinition { @Override public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/Jump.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/Jump.java index 09a8ff4..da7dfc7 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/Jump.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/Jump.java @@ -3,12 +3,15 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.AirborneActionDefinition; import com.floralquafloral.definitions.actions.CharaStat; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -81,4 +84,11 @@ public class Jump extends AirborneActionDefinition { @Override public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return Fall.attemptKick(data, clientData, travelData, entityTarget, blockTarget); + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/LongJump.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/LongJump.java index c982ef6..c7898be 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/LongJump.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/LongJump.java @@ -3,13 +3,16 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.AirborneActionDefinition; import com.floralquafloral.definitions.actions.CharaStat; import com.floralquafloral.definitions.actions.StatCategory; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -84,4 +87,11 @@ public class LongJump extends AirborneActionDefinition { @Override public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/Sideflip.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/Sideflip.java index 433831d..7b35928 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/Sideflip.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/Sideflip.java @@ -1,12 +1,16 @@ package com.floralquafloral.registries.states.action.baseactions.airborne; import com.floralquafloral.MarioQuaMario; +import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.CharaStat; import com.floralquafloral.definitions.actions.StatCategory; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -50,4 +54,11 @@ public void airborneTravel(MarioTravelData data) { AerialTransitions.makeJumpCapTransition(this, 0.65) ); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/TripleJump.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/TripleJump.java index 2d2e5d5..e8d1917 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/TripleJump.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/airborne/TripleJump.java @@ -5,10 +5,14 @@ import com.floralquafloral.definitions.actions.GroundedActionDefinition; import com.floralquafloral.definitions.actions.CharaStat; import com.floralquafloral.definitions.actions.StatCategory; +import com.floralquafloral.mariodata.MarioData; +import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.util.Easings; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -75,4 +79,11 @@ public List getTransitionInjections() { makeInjectionFrom("qua_mario:p_jump") ); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/AquaticGroundPound.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/AquaticGroundPound.java index 00cfea8..bcbb10d 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/AquaticGroundPound.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/AquaticGroundPound.java @@ -7,13 +7,15 @@ import com.floralquafloral.definitions.actions.StatCategory; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.registries.states.action.baseactions.airborne.GroundPound; import com.floralquafloral.util.MarioSFX; import net.minecraft.util.Identifier; -import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -38,7 +40,7 @@ public class AquaticGroundPound extends AquaticActionDefinition { return SlidingStatus.NOT_SLIDING; } @Override public @Nullable Identifier getStompType() { - return null; + return Identifier.of(MarioQuaMario.MOD_ID, "aquatic_ground_pound"); } @Override public BumpingRule getBumpingRule() { return BumpingRule.GROUND_POUND; @@ -92,7 +94,10 @@ public class AquaticGroundPound extends AquaticActionDefinition { new ActionTransitionDefinition("qua_mario:ground_pound_landing", AirborneActionDefinition.AerialTransitions.BASIC_LANDING.EVALUATOR, data -> data.setForwardStrafeVel(0, 0), - (data, isSelf, seed) -> data.playSoundEvent(MarioSFX.AQUATIC_GROUND_POUND, seed) + (data, isSelf, seed) -> { + data.stopStoredSound(MarioSFX.DIVE); + data.playSoundEvent(MarioSFX.AQUATIC_GROUND_POUND, seed); + } ) ); } @@ -100,4 +105,11 @@ public class AquaticGroundPound extends AquaticActionDefinition { @Override public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/Submerged.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/Submerged.java index 53c0fc7..f9b5dcd 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/Submerged.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/Submerged.java @@ -2,13 +2,15 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.definitions.actions.AquaticActionDefinition; -import com.floralquafloral.definitions.actions.CharaStat; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -82,4 +84,11 @@ public class Submerged extends AquaticActionDefinition { @Override public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/Swim.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/Swim.java index 43dfeca..26eb2eb 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/Swim.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/Swim.java @@ -9,7 +9,7 @@ public class Swim extends Submerged { public static final ActionTransitionDefinition SWIM = new ActionTransitionDefinition( "qua_mario:swim", - data -> data.getTimers().actionTimer > 3 && data.getInputs().JUMP.isPressed(), + data -> data.getTimers().actionTimer > 2 && data.getInputs().JUMP.isPressed(), data -> { data.setYVel(Math.min(0.45, data.getYVel() + 0.4)); data.getTimers().actionTimer = 0; diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/UnderwaterDuck.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/UnderwaterDuck.java index 4ccdf5f..3127673 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/UnderwaterDuck.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/UnderwaterDuck.java @@ -2,14 +2,16 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.definitions.actions.AquaticActionDefinition; -import com.floralquafloral.definitions.actions.CharaStat; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.registries.states.action.baseactions.grounded.DuckWaddle; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -93,4 +95,11 @@ public class UnderwaterDuck extends AquaticActionDefinition { @Override public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/UnderwaterWalk.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/UnderwaterWalk.java index ed60b33..0f6edb5 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/UnderwaterWalk.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/aquatic/UnderwaterWalk.java @@ -6,11 +6,14 @@ import com.floralquafloral.definitions.actions.GroundedActionDefinition; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.util.MarioSFX; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -108,4 +111,11 @@ public class UnderwaterWalk extends AquaticActionDefinition { @Override public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/ActionBasic.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/ActionBasic.java index 1e39e2b..45a554f 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/ActionBasic.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/ActionBasic.java @@ -3,13 +3,17 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.GroundedActionDefinition; import com.floralquafloral.definitions.actions.CharaStat; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.joml.Vector2d; +import net.minecraft.entity.Entity; + import static com.floralquafloral.definitions.actions.StatCategory.*; @@ -196,4 +200,11 @@ public List getWorldCollisionTransitions() { public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/DuckSlide.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/DuckSlide.java index ceb2b9c..8cfcf74 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/DuckSlide.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/DuckSlide.java @@ -3,15 +3,18 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.GroundedActionDefinition; import com.floralquafloral.registries.states.action.baseactions.airborne.LongJump; import com.floralquafloral.definitions.actions.CharaStat; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.joml.Vector2d; +import net.minecraft.entity.Entity; import java.util.List; @@ -155,4 +158,11 @@ public List getTransitionInjections() { ) ); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/DuckWaddle.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/DuckWaddle.java index c3be391..e65e7c4 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/DuckWaddle.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/DuckWaddle.java @@ -3,14 +3,17 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.GroundedActionDefinition; import com.floralquafloral.registries.states.action.baseactions.airborne.Backflip; import com.floralquafloral.definitions.actions.CharaStat; import com.floralquafloral.util.MarioSFX; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -133,4 +136,11 @@ public List getWorldCollisionTransitions() { public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/GroundPoundLanding.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/GroundPoundLanding.java index b7f7f68..68e6354 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/GroundPoundLanding.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/GroundPoundLanding.java @@ -4,13 +4,15 @@ import com.floralquafloral.definitions.actions.AquaticActionDefinition; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.moveable.MarioMainClientData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.GroundedActionDefinition; -import com.floralquafloral.registries.states.action.baseactions.aquatic.UnderwaterWalk; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -50,14 +52,27 @@ public void groundedTravel(MarioTravelData data) { @Override public List getPreTravelTransitions() { return List.of( + new ActionTransitionDefinition("qua_mario:aquatic_ground_pound", + data -> GroundedTransitions.ENTER_WATER.EVALUATOR.shouldTransition(data) + && data.getTimers().actionTimer > 3 + && data.getInputs().DUCK.isHeld() + && ((MarioMainClientData) data).canRepeatPound, + data -> data.setYVel(-0.25) + ), new ActionTransitionDefinition("qua_mario:ground_pound", - data -> data.getTimers().actionTimer > 3 && data.getInputs().DUCK.isHeld() && ((MarioMainClientData) data).canRepeatPound + data -> data.getTimers().actionTimer > 3 + && data.getInputs().DUCK.isHeld() + && ((MarioMainClientData) data).canRepeatPound, + data -> data.setYVel(-0.25) ), new ActionTransitionDefinition("qua_mario:underwater_walk", - data -> (data.getTimers().actionTimer > 4 && !data.getInputs().DUCK.isHeld()) + data -> GroundedTransitions.ENTER_WATER.EVALUATOR.shouldTransition(data) + && data.getTimers().actionTimer > 4 + && !data.getInputs().DUCK.isHeld() ), new ActionTransitionDefinition("qua_mario:basic", - data -> (data.getTimers().actionTimer > 4 && !data.getInputs().DUCK.isHeld()) + data -> (data.getTimers().actionTimer > 4 + && !data.getInputs().DUCK.isHeld()) ) ); } @@ -88,4 +103,11 @@ public List getWorldCollisionTransitions() { public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/PRun.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/PRun.java index 735d5fc..cfb9ba7 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/PRun.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/PRun.java @@ -3,13 +3,16 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.GroundedActionDefinition; import com.floralquafloral.definitions.actions.CharaStat; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.joml.Vector2d; +import net.minecraft.entity.Entity; import java.util.List; @@ -96,4 +99,11 @@ public List getWorldCollisionTransitions() { public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/Skid.java b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/Skid.java index 08b1ce5..a5d8623 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/Skid.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/action/baseactions/grounded/Skid.java @@ -3,14 +3,17 @@ import com.floralquafloral.MarioQuaMario; import com.floralquafloral.mariodata.MarioAuthoritativeData; import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.definitions.actions.GroundedActionDefinition; import com.floralquafloral.registries.states.action.baseactions.airborne.Sideflip; import com.floralquafloral.definitions.actions.CharaStat; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.List; @@ -108,4 +111,11 @@ public List getWorldCollisionTransitions() { public List getTransitionInjections() { return List.of(); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/powerup/ParsedPowerUp.java b/mod/src/main/java/com/floralquafloral/registries/states/powerup/ParsedPowerUp.java index 644026a..3a92c78 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/powerup/ParsedPowerUp.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/powerup/ParsedPowerUp.java @@ -1,13 +1,18 @@ package com.floralquafloral.registries.states.powerup; +import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioTravelData; import com.floralquafloral.registries.states.ParsedMajorMarioState; import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.util.MarioSFX; import com.floralquafloral.definitions.PowerUpDefinition; import net.minecraft.sound.SoundEvent; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; + public class ParsedPowerUp extends ParsedMajorMarioState { @@ -15,6 +20,7 @@ public class ParsedPowerUp extends ParsedMajorMarioState { public final float VOICE_PITCH; public final SoundEvent ACQUISITION_SOUND; public final Identifier REVERT_TARGET; + private final PowerUpDefinition POWER_UP_DEFINITION; @NotNull public final PowerUpDefinition.PowerHeart HEART; @NotNull public final PowerUpDefinition.PowerHeart HEART_HARDCORE; @@ -23,6 +29,7 @@ public class ParsedPowerUp extends ParsedMajorMarioState { public ParsedPowerUp(PowerUpDefinition definition) { super(definition); + this.POWER_UP_DEFINITION = definition; this.VALUE = definition.getValue(); this.VOICE_PITCH = definition.getVoicePitch(); @@ -42,4 +49,11 @@ public void acquirePower(MarioData data) { public void losePower(MarioData data) { ((PowerUpDefinition) this.DEFINITION).losePower(data); } + + public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return this.POWER_UP_DEFINITION.interceptAttack(data, clientData, travelData, entityTarget, blockTarget); + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/powerup/basepowerups/SmallForm.java b/mod/src/main/java/com/floralquafloral/registries/states/powerup/basepowerups/SmallForm.java index 07304a7..1f38d3a 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/powerup/basepowerups/SmallForm.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/powerup/basepowerups/SmallForm.java @@ -6,10 +6,13 @@ import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.definitions.PowerUpDefinition; import com.floralquafloral.definitions.actions.StatCategory; +import com.floralquafloral.mariodata.MarioTravelData; import net.minecraft.sound.SoundEvent; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.Map; import java.util.Set; @@ -101,4 +104,11 @@ public float getVoicePitch() { "small" ); } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/states/powerup/basepowerups/SuperForm.java b/mod/src/main/java/com/floralquafloral/registries/states/powerup/basepowerups/SuperForm.java index 3ba32f7..273e683 100644 --- a/mod/src/main/java/com/floralquafloral/registries/states/powerup/basepowerups/SuperForm.java +++ b/mod/src/main/java/com/floralquafloral/registries/states/powerup/basepowerups/SuperForm.java @@ -6,10 +6,13 @@ import com.floralquafloral.mariodata.MarioData; import com.floralquafloral.definitions.PowerUpDefinition; import com.floralquafloral.definitions.actions.StatCategory; +import com.floralquafloral.mariodata.MarioTravelData; import net.minecraft.sound.SoundEvent; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import net.minecraft.entity.Entity; import java.util.Map; import java.util.Set; @@ -102,4 +105,11 @@ public float getVoicePitch() { public @Nullable PowerHeartEmpty getHeartEmpty() { return null; } + + @Override public boolean interceptAttack( + MarioData data, @Nullable MarioClientSideData clientData, @Nullable MarioTravelData travelData, + @Nullable Entity entityTarget, @Nullable BlockPos blockTarget + ) { + return false; + } } diff --git a/mod/src/main/java/com/floralquafloral/registries/stomp/ParsedStomp.java b/mod/src/main/java/com/floralquafloral/registries/stomp/ParsedStomp.java index 46071d4..e12e755 100644 --- a/mod/src/main/java/com/floralquafloral/registries/stomp/ParsedStomp.java +++ b/mod/src/main/java/com/floralquafloral/registries/stomp/ParsedStomp.java @@ -138,7 +138,7 @@ public void executeClient(MarioClientSideData data, boolean isSelf, Entity targe public boolean attempt(MarioServerData data, Vec3d movement) { ServerPlayerEntity mario = data.getMario(); - List targets = mario.getWorld().getOtherEntities(mario, mario.getBoundingBox().stretch(movement.multiply(1, 2, 1))); + List targets = mario.getWorld().getOtherEntities(mario, mario.getBoundingBox().stretch(movement.multiply(1, 1, 1))); boolean affectMario = true; long seed = RandomSeed.getSeed(); diff --git a/mod/src/main/java/com/floralquafloral/registries/stomp/basestomptypes/AquaticGroundPoundStomp.java b/mod/src/main/java/com/floralquafloral/registries/stomp/basestomptypes/AquaticGroundPoundStomp.java new file mode 100644 index 0000000..941bc26 --- /dev/null +++ b/mod/src/main/java/com/floralquafloral/registries/stomp/basestomptypes/AquaticGroundPoundStomp.java @@ -0,0 +1,74 @@ +package com.floralquafloral.registries.stomp.basestomptypes; + +import com.floralquafloral.MarioQuaMario; +import com.floralquafloral.definitions.StompDefinition; +import com.floralquafloral.definitions.actions.CharaStat; +import com.floralquafloral.definitions.actions.StatCategory; +import com.floralquafloral.mariodata.MarioClientSideData; +import com.floralquafloral.mariodata.MarioData; +import com.floralquafloral.mariodata.MarioTravelData; +import com.floralquafloral.registries.stomp.StompHandler; +import com.floralquafloral.util.MarioSFX; +import net.minecraft.entity.Entity; +import net.minecraft.entity.MovementType; +import net.minecraft.item.ItemStack; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.sound.SoundEvent; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.Vec3d; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class AquaticGroundPoundStomp implements StompDefinition { + @Override public @NotNull Identifier getID() { + return Identifier.of(MarioQuaMario.MOD_ID, "aquatic_ground_pound"); + } + + public final CharaStat BASE_DAMAGE = new CharaStat(4.5, StatCategory.STOMP_BASE_DAMAGE); + public final CharaStat BOUNCE_VEL = new CharaStat(0.88, StatCategory.STOMP_BOUNCE); + + @Override public boolean mustFallOnTarget() { + return true; + } + + @Override public @NotNull PainfulStompResponse getPainfulStompResponse() { + return PainfulStompResponse.INJURY; + } + + @Override public boolean shouldAttemptMounting() { + return true; + } + + @Override public boolean canHitNonLiving() { + return true; + } + + @Override public @NotNull Identifier getDamageType() { + return Identifier.of(MarioQuaMario.MOD_ID, "ground_pound"); + } + @Override public @Nullable SoundEvent getSoundEvent() { + return MarioSFX.STOMP; + } + + @Override public @Nullable Identifier getPostStompAction() { + return null; + } + + @Override public boolean canStompTarget(MarioData data, Entity target) { + return !target.getType().isIn(StompHandler.IMMUNE_TO_BASIC_STOMP_TAG); + } + + @Override public float calculateDamage(MarioData data, ServerPlayerEntity mario, ItemStack equipment, float equipmentArmorValue, Entity target) { + return ((float) BASE_DAMAGE.get(data)) + equipmentArmorValue * 2.25F / 3; + } + + @Override public void executeTravellers(MarioTravelData data, Entity target, boolean harmless) { + double deltaY = (target.getY() + target.getHeight()) - data.getMario().getY(); + data.getMario().move(MovementType.SELF, new Vec3d(0, deltaY, 0)); + data.setYVel(BOUNCE_VEL.get(data)); + } + + @Override public void executeClients(MarioClientSideData data, boolean isSelf, Entity target, boolean harmless, long seed) { + data.stopStoredSound(MarioSFX.DIVE); + } +} diff --git a/mod/src/main/java/com/floralquafloral/registries/stomp/basestomptypes/JumpStomp.java b/mod/src/main/java/com/floralquafloral/registries/stomp/basestomptypes/JumpStomp.java index 458efe2..1d6cdd8 100644 --- a/mod/src/main/java/com/floralquafloral/registries/stomp/basestomptypes/JumpStomp.java +++ b/mod/src/main/java/com/floralquafloral/registries/stomp/basestomptypes/JumpStomp.java @@ -64,14 +64,7 @@ public class JumpStomp implements StompDefinition { @Override public void executeTravellers(MarioTravelData data, Entity target, boolean harmless) { double deltaY = (target.getY() + target.getHeight()) - data.getMario().getY(); -// MarioQuaMario.LOGGER.info("executeTravellers 1:" -// + "\nTarget: " + target -// + "\nTargetY: " + (target.getY() + target.getHeight()) -// + "\nMarioY: " + data.getMario().getY() -// + "\ndeltaY: " + (data.getMario().getY()) -// ); data.getMario().move(MovementType.SELF, new Vec3d(0, deltaY, 0)); -// data.getMario().setPos(data.getMario().getX(), target.getY() + target.getHeight(), data.getMario().getZ()); data.setYVel(BOUNCE_VEL.get(data)); } diff --git a/mod/src/main/resources/fabric.mod.json b/mod/src/main/resources/fabric.mod.json index 103866d..7d48590 100644 --- a/mod/src/main/resources/fabric.mod.json +++ b/mod/src/main/resources/fabric.mod.json @@ -65,7 +65,8 @@ "mario-stomp-types": [ "com.floralquafloral.registries.stomp.basestomptypes.JumpStomp", - "com.floralquafloral.registries.stomp.basestomptypes.GroundPoundStomp" + "com.floralquafloral.registries.stomp.basestomptypes.GroundPoundStomp", + "com.floralquafloral.registries.stomp.basestomptypes.AquaticGroundPoundStomp" ], "main": [