-
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
f524518
commit 9d4c307
Showing
17 changed files
with
650 additions
and
7 deletions.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.fqf.mario_qua_mario.mariodata; | ||
|
||
import net.minecraft.util.Identifier; | ||
|
||
public interface IMarioAuthoritativeData { | ||
boolean setAction(Identifier actionID); | ||
boolean setAction(String actionID); | ||
|
||
boolean setActionTransitionless(Identifier actionID); | ||
boolean setActionTransitionless(String actionID); | ||
|
||
boolean setPowerUp(Identifier powerUpID); | ||
boolean setPowerUp(String powerUpID); | ||
|
||
boolean setCharacter(Identifier characterID); | ||
boolean setCharacter(String characterID); | ||
} |
50 changes: 50 additions & 0 deletions
50
api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioClientData.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,50 @@ | ||
package com.fqf.mario_qua_mario.mariodata; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.sound.SoundCategory; | ||
import net.minecraft.sound.SoundEvent; | ||
|
||
public interface IMarioClientData extends IMarioData { | ||
SoundInstanceWrapper playSound( | ||
SoundEvent event, SoundCategory category, | ||
double x, double y, double z, | ||
float pitch, float volume, long seed | ||
); | ||
|
||
SoundInstanceWrapper playSound(SoundEvent event, long seed); | ||
SoundInstanceWrapper playSound(SoundEvent event, float pitch, float volume, long seed); | ||
SoundInstanceWrapper playSound(SoundEvent event, Entity entity, SoundCategory category, long seed); | ||
|
||
void playJumpSound(long seed); | ||
void fadeJumpSound(); | ||
|
||
SoundInstanceWrapper voice(VoiceLine line, long seed); | ||
float getVoicePitch(); | ||
|
||
void storeSound(SoundInstanceWrapper instance); | ||
void stopStoredSound(SoundEvent event); | ||
|
||
enum VoiceLine { | ||
SELECT, | ||
DUCK, | ||
|
||
DOUBLE_JUMP, | ||
TRIPLE_JUMP, | ||
GYMNAST_SALUTE, | ||
|
||
DUCK_JUMP, | ||
LONG_JUMP, | ||
BACKFLIP, | ||
SIDEFLIP, | ||
WALL_JUMP, | ||
|
||
REVERT, | ||
BURNT, | ||
|
||
FIREBALL, | ||
GET_STAR | ||
} | ||
|
||
interface SoundInstanceWrapper { | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
api/src/main/java/com/fqf/mario_qua_mario/mariodata/IMarioData.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,25 @@ | ||
package com.fqf.mario_qua_mario.mariodata; | ||
|
||
import com.fqf.mario_qua_mario.util.CharaStat; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public interface IMarioData { | ||
PlayerEntity getMario(); | ||
boolean isClient(); | ||
|
||
double getStat(CharaStat stat); | ||
double getStatMultiplier(CharaStat stat); | ||
int getBumpStrengthModifier(); | ||
|
||
boolean canSneak(); | ||
boolean canSprint(); | ||
|
||
boolean isEnabled(); | ||
Identifier getActionID(); | ||
Identifier getPowerUpID(); | ||
Identifier getCharacterID(); | ||
} |
37 changes: 37 additions & 0 deletions
37
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.fqf.mario_qua_mario.mariodata; | ||
|
||
public interface IMarioTravelData extends IMarioData { | ||
double getForwardVel(); | ||
double getStrafeVel(); | ||
double getYVel(); | ||
|
||
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; | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
api/src/main/java/com/fqf/mario_qua_mario/util/CharaStat.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,36 @@ | ||
package com.fqf.mario_qua_mario.util; | ||
|
||
import com.fqf.mario_qua_mario.mariodata.IMarioData; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
* Represents a numerical value that might vary depending on character and power-up form. | ||
* This is used for movement, speed thresholds, and damage calculations. | ||
*/ | ||
public class CharaStat { | ||
public final double BASE; | ||
public final Set<StatCategory> CATEGORIES; | ||
|
||
public CharaStat(double base, StatCategory... categories) { | ||
this(base, Set.of(categories)); | ||
} | ||
public CharaStat variate(double multiplier) { | ||
return new CharaStat(this.BASE * multiplier, this.CATEGORIES); | ||
} | ||
|
||
private CharaStat(double base, Set<StatCategory> categorySet) { | ||
this.BASE = base; | ||
this.CATEGORIES = categorySet; | ||
} | ||
|
||
public double get(IMarioData data) { | ||
return data.getStat(this); | ||
} | ||
public double getAsThreshold(IMarioData data) { | ||
return this.get(data) * 0.96; | ||
} | ||
public double getAsLimit(IMarioData data) { | ||
return this.get(data) * 1.015; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
api/src/main/java/com/fqf/mario_qua_mario/util/StatCategory.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,39 @@ | ||
package com.fqf.mario_qua_mario.util; | ||
|
||
public enum StatCategory { | ||
WALKING, | ||
RUNNING, | ||
P_RUNNING, | ||
DUCKING, | ||
|
||
DRIFTING, // Airborne | ||
|
||
SWIMMING, // Aquatic | ||
|
||
ACCELERATION, | ||
OVERSPEED_CORRECTION, // Used INSTEAD OF acceleration for overwalk, overrun, etc. type stats. | ||
SPEED, | ||
REDIRECTION, | ||
THRESHOLD, | ||
|
||
FORWARD, | ||
BACKWARD, | ||
STRAFE, | ||
|
||
DRAG, | ||
FRICTION, // Mostly for Luigi? | ||
WATER_DRAG, | ||
|
||
JUMP_VELOCITY, | ||
JUMP_CAP, | ||
|
||
JUMPING_GRAVITY, | ||
NORMAL_GRAVITY, | ||
AQUATIC_GRAVITY, | ||
TERMINAL_VELOCITY, | ||
AQUATIC_TERMINAL_VELOCITY, | ||
|
||
STOMP_BASE_DAMAGE, | ||
STOMP_ARMOR_MULTIPLIER, | ||
STOMP_BOUNCE | ||
} |
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
113 changes: 113 additions & 0 deletions
113
mod/src/client/java/com/fqf/mario_qua_mario/mariodata/IMarioClientDataImpl.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,113 @@ | ||
package com.fqf.mario_qua_mario.mariodata; | ||
|
||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.sound.PositionedSoundInstance; | ||
import net.minecraft.client.sound.SoundInstance; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.sound.SoundCategory; | ||
import net.minecraft.sound.SoundEvent; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.math.Vec3d; | ||
import net.minecraft.util.math.random.Random; | ||
|
||
import java.util.EnumMap; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public interface IMarioClientDataImpl extends IMarioClientData { | ||
@Override | ||
default boolean isClient() { | ||
return true; | ||
} | ||
|
||
@Override | ||
default SoundInstanceWrapperImpl playSound( | ||
SoundEvent event, SoundCategory category, | ||
double x, double y, double z, | ||
float pitch, float volume, long seed | ||
) { | ||
SoundInstance sound = new PositionedSoundInstance( | ||
event, category, | ||
volume, pitch, | ||
Random.create(seed), | ||
x, y, z | ||
); | ||
MinecraftClient.getInstance().getSoundManager().play(sound); | ||
return new SoundInstanceWrapperImpl(sound); | ||
} | ||
|
||
@Override | ||
default SoundInstanceWrapperImpl playSound(SoundEvent event, long seed) { | ||
return this.playSound(event, 1F, 1F, seed); | ||
} | ||
|
||
@Override | ||
default SoundInstanceWrapperImpl playSound(SoundEvent event, float pitch, float volume, long seed) { | ||
Vec3d marioPos = this.getMario().getPos(); | ||
return this.playSound(event, SoundCategory.PLAYERS, marioPos.x, marioPos.y, marioPos.z, 1F, 1F, seed); | ||
} | ||
|
||
@Override | ||
default SoundInstanceWrapperImpl playSound(SoundEvent event, Entity entity, SoundCategory category, long seed) { | ||
return this.playSound(event, category, entity.getX(), entity.getY(), entity.getZ(), 1F, 1F, seed); | ||
} | ||
|
||
@Override | ||
default void playJumpSound(long seed) { | ||
|
||
} | ||
|
||
@Override | ||
default void fadeJumpSound() { | ||
|
||
} | ||
|
||
Map<IMarioClientDataImpl, SoundInstance> MARIO_VOICE_LINES = new HashMap<>(); | ||
|
||
@Override | ||
default SoundInstanceWrapperImpl voice(VoiceLine line, long seed) { | ||
MinecraftClient.getInstance().getSoundManager().stop(MARIO_VOICE_LINES.get(this)); | ||
Vec3d marioPos = this.getMario().getPos(); | ||
SoundInstanceWrapperImpl newVoiceSound = this.playSound( | ||
VOICE_SOUND_EVENTS.get(line).get(this.getCharacterID()), SoundCategory.VOICE, | ||
marioPos.x, marioPos.y, marioPos.z, | ||
this.getVoicePitch(), 1.0F, | ||
seed | ||
); | ||
|
||
MARIO_VOICE_LINES.put(this, newVoiceSound.SOUND); | ||
|
||
return newVoiceSound; | ||
} | ||
|
||
@Override | ||
default float getVoicePitch() { | ||
// return ((MarioPlayerData) this).getPowerUp().; | ||
return 1; | ||
} | ||
|
||
Map<IMarioClientDataImpl, Map<Identifier, SoundInstance>> STORED_SOUNDS = new HashMap<>(); | ||
|
||
@Override | ||
default void storeSound(SoundInstanceWrapper instance) { | ||
STORED_SOUNDS.putIfAbsent(this, new HashMap<>()); | ||
SoundInstance sound = ((SoundInstanceWrapperImpl) instance).SOUND; | ||
STORED_SOUNDS.get(this).put(sound.getId(), sound); | ||
} | ||
|
||
@Override | ||
default void stopStoredSound(SoundEvent event) { | ||
if(STORED_SOUNDS.containsKey(this)) { | ||
|
||
} | ||
} | ||
|
||
class SoundInstanceWrapperImpl implements SoundInstanceWrapper { | ||
private final SoundInstance SOUND; | ||
public SoundInstanceWrapperImpl(SoundInstance sound) { | ||
this.SOUND = sound; | ||
} | ||
} | ||
|
||
EnumMap<VoiceLine, Map<Identifier, SoundEvent>> VOICE_SOUND_EVENTS = new EnumMap<>(VoiceLine.class); | ||
} |
28 changes: 27 additions & 1 deletion
28
mod/src/client/java/com/fqf/mario_qua_mario/mariodata/MarioMainClientData.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,5 +1,31 @@ | ||
package com.fqf.mario_qua_mario.mariodata; | ||
|
||
public class MarioMainClientData extends MarioPlayerData { | ||
import net.minecraft.client.network.ClientPlayerEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class MarioMainClientData extends MarioPlayerData implements IMarioClientDataImpl { | ||
private static MarioMainClientData instance; | ||
public static @Nullable MarioMainClientData getInstance() { | ||
return instance; | ||
} | ||
public static void clearInstance() { | ||
instance = null; | ||
} | ||
|
||
private ClientPlayerEntity mario; | ||
public MarioMainClientData(ClientPlayerEntity mario) { | ||
this.mario = mario; | ||
instance = this; | ||
} | ||
|
||
@Override | ||
public ClientPlayerEntity getMario() { | ||
return mario; | ||
} | ||
|
||
@Override | ||
public void setMario(PlayerEntity mario) { | ||
this.mario = (ClientPlayerEntity) mario; | ||
} | ||
} |
Oops, something went wrong.