-
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.
- Loading branch information
1 parent
9d4c307
commit 4199844
Showing
22 changed files
with
466 additions
and
82 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
api/src/main/java/com/fqf/mario_qua_mario/definitions/AttackInterceptingStateDefinition.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,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<AttackInterceptionDefinition> getUnarmedAttackInterceptions(); | ||
|
||
interface AttackInterceptionDefinition { | ||
@Nullable Identifier getActionTarget(); | ||
@Nullable Hand getHandToSwing(); | ||
boolean shouldTriggerAttackCooldown(); | ||
|
||
boolean shouldIntercept( | ||
|
||
); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
api/src/main/java/com/fqf/mario_qua_mario/definitions/MarioStateDefinition.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,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); | ||
} |
23 changes: 23 additions & 0 deletions
23
api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/ActionDefinition.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,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(); | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/BumpingRule.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,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) | ||
* <p> | ||
* A strength of 3 represents Super Mario and Small Mario both bumping a Brick Block without destroying it. | ||
* (Example: Rolling into a wall, Bonking) | ||
* <p> | ||
* 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) | ||
* <p> | ||
* 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); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/CameraAnimationSet.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,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; | ||
} |
10 changes: 10 additions & 0 deletions
10
api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/SlidingStatus.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,10 @@ | ||
package com.fqf.mario_qua_mario.definitions.actions.util; | ||
|
||
public enum SlidingStatus { | ||
NOT_SLIDING, | ||
NOT_SLIDING_SMOOTH, | ||
|
||
SLIDING, | ||
SKIDDING, | ||
WALL_SLIDING | ||
} |
8 changes: 8 additions & 0 deletions
8
api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/SneakingRule.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,8 @@ | ||
package com.fqf.mario_qua_mario.definitions.actions.util; | ||
|
||
public enum SneakingRule { | ||
ALLOW, | ||
PROHIBIT, | ||
SLIP, | ||
FORCE | ||
} |
45 changes: 45 additions & 0 deletions
45
api/src/main/java/com/fqf/mario_qua_mario/definitions/actions/util/TransitionDefinition.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,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; | ||
} |
41 changes: 41 additions & 0 deletions
41
.../java/com/fqf/mario_qua_mario/definitions/actions/util/TransitionInjectionDefinition.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,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; | ||
} |
8 changes: 7 additions & 1 deletion
8
api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioAuthoritativeData.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
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
31 changes: 31 additions & 0 deletions
31
api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioReadableMotionData.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,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; | ||
} | ||
} | ||
} |
28 changes: 1 addition & 27 deletions
28
api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioTravelData.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,37 +1,11 @@ | ||
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) { | ||
this.setForwardVel(forward); | ||
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; | ||
} | ||
} | ||
} |
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.