-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Getting some weirdness where Mario transitions back into Fall on the …
…client side after landing...? :( Need to figure that out...
- Loading branch information
1 parent
d40b45a
commit d7b3a93
Showing
29 changed files
with
570 additions
and
117 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
api/src/main/java/com/fqf/mario_qua_mario/definitions/states/CharacterDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
package com.fqf.mario_qua_mario.definitions.states; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.util.Identifier; | ||
|
||
public interface CharacterDefinition extends StatAlteringStateDefinition { | ||
Identifier getInitialAction(); | ||
Identifier getInitialPowerUp(); | ||
|
||
Identifier getMountedAction(Entity vehicle); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...main/java/com/fqf/mario_qua_mario/definitions/states/actions/MountedActionDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.fqf.mario_qua_mario.definitions.states.actions; | ||
|
||
import com.fqf.mario_qua_mario.definitions.states.actions.util.IncompleteActionDefinition; | ||
import com.fqf.mario_qua_mario.definitions.states.actions.util.TransitionDefinition; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioReadableMotionData; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData; | ||
import com.fqf.mario_qua_mario.util.CharaStat; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.util.math.Vec3d; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.List; | ||
|
||
public interface MountedActionDefinition extends IncompleteActionDefinition { | ||
boolean travelHook(IMarioTravelData data, Entity mount, MountedActionHelper helper); | ||
|
||
@NotNull List<TransitionDefinition> getBasicTransitions(MountedActionHelper helper); | ||
@NotNull List<TransitionDefinition> getInputTransitions(MountedActionHelper helper); | ||
@NotNull List<TransitionDefinition> getWorldCollisionTransitions(MountedActionHelper helper); | ||
|
||
/** | ||
* Contains a number of methods intended to help with the creation of Mounted Actions. Can be cast to any of the | ||
* other ActionHelpers, if for whatever reason you need them. | ||
*/ | ||
interface MountedActionHelper { | ||
Entity getMount(IMarioReadableMotionData data); | ||
|
||
void dismount(IMarioTravelData data, boolean reposition); | ||
|
||
double getSlipFactor(Entity mount); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ public enum ActionCategory { | |
GROUNDED, | ||
AIRBORNE, | ||
AQUATIC, | ||
WALL | ||
WALLBOUND, | ||
MOUNTED | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
content/src/main/java/com/fqf/mario_qua_mario/actions/airborne/Fall.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.fqf.mario_qua_mario.actions.airborne; | ||
|
||
import com.fqf.mario_qua_mario.MarioQuaMarioContent; | ||
import com.fqf.mario_qua_mario.definitions.states.actions.AirborneActionDefinition; | ||
import com.fqf.mario_qua_mario.definitions.states.actions.util.*; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioAuthoritativeData; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioClientData; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData; | ||
import com.fqf.mario_qua_mario.util.CharaStat; | ||
import net.minecraft.util.Identifier; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import static com.fqf.mario_qua_mario.util.StatCategory.*; | ||
|
||
public class Fall implements AirborneActionDefinition { | ||
@Override public @NotNull Identifier getID() { | ||
return MarioQuaMarioContent.makeID("fall"); | ||
} | ||
|
||
@Override public @Nullable String getAnimationName() { | ||
return null; | ||
} | ||
@Override public @Nullable CameraAnimationSet getCameraAnimations() { | ||
return null; | ||
} | ||
@Override public @NotNull SlidingStatus getSlidingStatus() { | ||
return SlidingStatus.NOT_SLIDING; | ||
} | ||
|
||
@Override public @NotNull SneakingRule getSneakingRule() { | ||
return SneakingRule.PROHIBIT; | ||
} | ||
@Override public @NotNull SprintingRule getSprintingRule() { | ||
return SprintingRule.PROHIBIT; | ||
} | ||
|
||
@Override public @Nullable BumpType getBumpType() { | ||
return null; | ||
} | ||
@Override public @Nullable Identifier getStompTypeID() { | ||
return null; | ||
} | ||
|
||
public static final CharaStat FALL_ACCEL = new CharaStat(-0.115, NORMAL_GRAVITY); | ||
public static final CharaStat FALL_SPEED = new CharaStat(-3.25, TERMINAL_VELOCITY); | ||
|
||
public static final TransitionDefinition FALL = new TransitionDefinition( | ||
MarioQuaMarioContent.makeID("fall"), | ||
data -> !data.getMario().isOnGround(), | ||
EvaluatorEnvironment.COMMON | ||
); | ||
|
||
@Override public void clientTick(IMarioClientData data, boolean isSelf) { | ||
|
||
} | ||
@Override public void serverTick(IMarioAuthoritativeData data) { | ||
|
||
} | ||
@Override public void travelHook(IMarioTravelData data, AirborneActionHelper helper) { | ||
helper.applyGravity(data, FALL_ACCEL, null, FALL_SPEED); | ||
} | ||
|
||
@Override public @NotNull List<TransitionDefinition> getBasicTransitions(AirborneActionHelper helper) { | ||
return List.of(); | ||
} | ||
@Override public @NotNull List<TransitionDefinition> getInputTransitions(AirborneActionHelper helper) { | ||
return List.of(); | ||
} | ||
@Override public @NotNull List<TransitionDefinition> getWorldCollisionTransitions(AirborneActionHelper helper) { | ||
return List.of( | ||
new TransitionDefinition( | ||
MarioQuaMarioContent.makeID("sub_walk"), | ||
data -> data.getMario().isOnGround(), | ||
EvaluatorEnvironment.CLIENT_CHECKED | ||
) | ||
); | ||
} | ||
|
||
@Override public @NotNull Set<TransitionInjectionDefinition> getTransitionInjections() { | ||
return Set.of(); | ||
} | ||
|
||
@Override public @NotNull List<AttackInterceptionDefinition> getUnarmedAttackInterceptions() { | ||
return List.of(); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
content/src/main/java/com/fqf/mario_qua_mario/actions/airborne/Jump.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.fqf.mario_qua_mario.actions.airborne; | ||
|
||
import com.fqf.mario_qua_mario.MarioQuaMarioContent; | ||
import com.fqf.mario_qua_mario.definitions.states.actions.AirborneActionDefinition; | ||
import com.fqf.mario_qua_mario.definitions.states.actions.GroundedActionDefinition; | ||
import com.fqf.mario_qua_mario.definitions.states.actions.util.*; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioAuthoritativeData; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioClientData; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData; | ||
import com.fqf.mario_qua_mario.util.CharaStat; | ||
import net.minecraft.util.Identifier; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import static com.fqf.mario_qua_mario.util.StatCategory.*; | ||
|
||
public class Jump extends Fall implements AirborneActionDefinition { | ||
@Override public @NotNull Identifier getID() { | ||
return MarioQuaMarioContent.makeID("jump"); | ||
} | ||
|
||
@Override public @Nullable String getAnimationName() { | ||
return null; | ||
} | ||
|
||
public static final CharaStat JUMP_GRAVITY = new CharaStat(-0.095, JUMPING_GRAVITY); | ||
|
||
public static final CharaStat JUMP_VEL = new CharaStat(0.858, JUMP_VELOCITY); | ||
public static final CharaStat JUMP_ADDEND = new CharaStat(0.2, JUMP_VELOCITY); | ||
|
||
public static TransitionDefinition makeJumpTransition(GroundedActionDefinition.GroundedActionHelper helper) { | ||
return new TransitionDefinition( | ||
MarioQuaMarioContent.makeID("jump"), | ||
data -> data.getInputs().JUMP.isPressed(), | ||
EvaluatorEnvironment.CLIENT_ONLY, | ||
data -> helper.performJump(data, JUMP_VEL, JUMP_ADDEND), | ||
(data, isSelf, seed) -> data.playJumpSound(seed) | ||
); | ||
} | ||
|
||
@Override public void clientTick(IMarioClientData data, boolean isSelf) { | ||
|
||
} | ||
@Override public void serverTick(IMarioAuthoritativeData data) { | ||
|
||
} | ||
@Override public void travelHook(IMarioTravelData data, AirborneActionHelper helper) { | ||
helper.applyGravity(data, Fall.FALL_ACCEL, JUMP_GRAVITY, Fall.FALL_SPEED); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
content/src/main/java/com/fqf/mario_qua_mario/actions/mounted/Mounted.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.fqf.mario_qua_mario.actions.mounted; | ||
|
||
import com.fqf.mario_qua_mario.MarioQuaMarioContent; | ||
import com.fqf.mario_qua_mario.definitions.states.actions.MountedActionDefinition; | ||
import com.fqf.mario_qua_mario.definitions.states.actions.util.*; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioAuthoritativeData; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioClientData; | ||
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.util.Identifier; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class Mounted implements MountedActionDefinition { | ||
@Override public @NotNull Identifier getID() { | ||
return MarioQuaMarioContent.makeID("mounted"); | ||
} | ||
|
||
@Override public @Nullable String getAnimationName() { | ||
return null; | ||
} | ||
@Override public @Nullable CameraAnimationSet getCameraAnimations() { | ||
return null; | ||
} | ||
@Override public @NotNull SlidingStatus getSlidingStatus() { | ||
return SlidingStatus.NOT_SLIDING; | ||
} | ||
|
||
@Override public @NotNull SneakingRule getSneakingRule() { | ||
return SneakingRule.PROHIBIT; | ||
} | ||
@Override public @NotNull SprintingRule getSprintingRule() { | ||
return SprintingRule.PROHIBIT; | ||
} | ||
|
||
@Override public @Nullable BumpType getBumpType() { | ||
return null; | ||
} | ||
@Override public @Nullable Identifier getStompTypeID() { | ||
return null; | ||
} | ||
|
||
@Override public void clientTick(IMarioClientData data, boolean isSelf) { | ||
|
||
} | ||
@Override public void serverTick(IMarioAuthoritativeData data) { | ||
|
||
} | ||
@Override public boolean travelHook(IMarioTravelData data, Entity mount, MountedActionHelper helper) { | ||
return false; | ||
} | ||
|
||
@Override public @NotNull List<TransitionDefinition> getBasicTransitions(MountedActionHelper helper) { | ||
return List.of( | ||
new TransitionDefinition( | ||
MarioQuaMarioContent.makeID("sub_walk"), | ||
data -> helper.getMount(data) == null, | ||
EvaluatorEnvironment.COMMON | ||
) | ||
); | ||
} | ||
@Override public @NotNull List<TransitionDefinition> getInputTransitions(MountedActionHelper helper) { | ||
return List.of( | ||
new TransitionDefinition( | ||
MarioQuaMarioContent.makeID("walk_run"), | ||
data -> data.getInputs().DUCK.isHeld() && data.getInputs().JUMP.isPressed(), | ||
EvaluatorEnvironment.CLIENT_ONLY, | ||
data -> { | ||
data.setYVel(1); | ||
helper.dismount(data, false); | ||
}, | ||
(data, isSelf, seed) -> data.playJumpSound(seed) | ||
) | ||
); | ||
} | ||
@Override public @NotNull List<TransitionDefinition> getWorldCollisionTransitions(MountedActionHelper helper) { | ||
return List.of(); | ||
} | ||
|
||
@Override public @NotNull Set<TransitionInjectionDefinition> getTransitionInjections() { | ||
return Set.of(); | ||
} | ||
|
||
@Override public @NotNull List<AttackInterceptionDefinition> getUnarmedAttackInterceptions() { | ||
return List.of(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.