diff --git a/common/src/main/java/net/hydra/jojomod/client/KeyInputRegistry.java b/common/src/main/java/net/hydra/jojomod/client/KeyInputRegistry.java index fd1c3049d..a3d912194 100644 --- a/common/src/main/java/net/hydra/jojomod/client/KeyInputRegistry.java +++ b/common/src/main/java/net/hydra/jojomod/client/KeyInputRegistry.java @@ -48,6 +48,14 @@ public class KeyInputRegistry { InputConstants.KEY_V, KeyInputRegistry.KEY_CATEGORY_JOJO ); + + public static KeyMapping[] abilityKeyList = { + abilityOneKey, + abilityTwoKey, + abilityThreeKey, + abilityFourKey + }; + public static KeyMapping menuKey = new KeyMapping( KeyInputRegistry.KEY_JOJO_MENU, InputConstants.KEY_Y, diff --git a/common/src/main/java/net/hydra/jojomod/client/KeyInputs.java b/common/src/main/java/net/hydra/jojomod/client/KeyInputs.java index a9564f6e6..40f15025c 100644 --- a/common/src/main/java/net/hydra/jojomod/client/KeyInputs.java +++ b/common/src/main/java/net/hydra/jojomod/client/KeyInputs.java @@ -42,7 +42,7 @@ public static void summonKey(Player player, Minecraft client){ public static void menuKey(Player player, Minecraft client){ if (((StandUser) player).roundabout$getSummonCD() && roundaboutClickCount == 0 && !player.isSpectator()) { - forceSummon(player,true); + forceSummon(player); PlayerMaskSlots ms = ((IPlayerEntity)player).roundabout$getMaskInventory(); ItemStack stack = ms.getItem(0); ItemStack stack2 = ms.getItem(1); @@ -58,17 +58,15 @@ public static void menuKey(Player player, Minecraft client){ roundaboutClickCount = 2; } - public static void forceSummon(Player player,boolean keyIsDown){ - if (keyIsDown) { - if (!((StandUser) player).roundabout$getStandDisc().isEmpty() && !((StandUser) player).roundabout$getActive()) { - if (((StandUser) player).roundabout$getStandPowers().canSummonStand() && !((StandUser) player).roundabout$isSealed()) { - if (((StandUser) player).roundabout$getSummonCD() && roundaboutClickCount == 0 && - ConfigManager.getClientConfig().pressingAbilityKeysSummonsStands) { - ((StandUser) player).roundabout$setActive(true); - ((StandUser) player).roundabout$setSummonCD(2); - C2SPacketUtil.trySingleBytePacket(PacketDataIndex.SINGLE_BYTE_SILENT_SUMMON); + public static void forceSummon(Player player){ + if (!((StandUser) player).roundabout$getStandDisc().isEmpty() && !((StandUser) player).roundabout$getActive()) { + if (((StandUser) player).roundabout$getStandPowers().canSummonStand() && !((StandUser) player).roundabout$isSealed()) { + if (((StandUser) player).roundabout$getSummonCD() && roundaboutClickCount == 0 && + ConfigManager.getClientConfig().pressingAbilityKeysSummonsStands) { + ((StandUser) player).roundabout$setActive(true); + ((StandUser) player).roundabout$setSummonCD(2); + C2SPacketUtil.trySingleBytePacket(PacketDataIndex.SINGLE_BYTE_SILENT_SUMMON); - } } } } @@ -85,51 +83,12 @@ public static void switchRowsKey(Player player, Minecraft client, boolean keyIsD public static void showEXPKey(Player player, Minecraft client, boolean keyIsDown, Options option){ ((IPlayerEntity) player).roundabout$showExp(keyIsDown); } - public static void MoveKey4(Player player, Minecraft client, boolean keyIsDown, Options option){ - if (!((StandUser) player).roundabout$isSealed() && !((StandUser)player).roundabout$isPossessed()) { - if (FateTypes.isHuman(player)) { - forceSummon(player, keyIsDown); - } - ((StandUser) player).roundabout$getStandPowers().preButtonInput4(keyIsDown, option); - } - if (!FateTypes.isHuman(player)) { - ((IFatePlayer) player).rdbt$getFatePowers().preButtonInput4(keyIsDown, option); - } - } - public static void MoveKey3(Player player, Minecraft client, boolean keyIsDown, Options option){ - if (!((StandUser) player).roundabout$isSealed() && !((StandUser)player).roundabout$isPossessed()) { - if (FateTypes.isHuman(player)) { - forceSummon(player, keyIsDown); - } - ((StandUser) player).roundabout$getStandPowers().preButtonInput3(keyIsDown, option); - } - if (!FateTypes.isHuman(player)) { - ((IFatePlayer) player).rdbt$getFatePowers().preButtonInput3(keyIsDown, option); - } - } - public static void MoveKey2(Player player, Minecraft client, boolean keyIsDown, Options option){ - if (!((StandUser) player).roundabout$isSealed() && !((StandUser)player).roundabout$isPossessed()) { - if (FateTypes.isHuman(player)) { - forceSummon(player, keyIsDown); - } - ((StandUser) player).roundabout$getStandPowers().preButtonInput2(keyIsDown, option); - } - if (!FateTypes.isHuman(player)) { - ((IFatePlayer) player).rdbt$getFatePowers().preButtonInput2(keyIsDown, option); - } - } - public static void MoveKey1(Player player, Minecraft client, boolean keyIsDown, Options option){ - if (!((StandUser) player).roundabout$isSealed() && !((StandUser)player).roundabout$isPossessed()) { - if (FateTypes.isHuman(player)) { - forceSummon(player, keyIsDown); - } - ((StandUser) player).roundabout$getStandPowers().preButtonInput1(keyIsDown, option); - } - if (!FateTypes.isHuman(player)) { - ((IFatePlayer) player).rdbt$getFatePowers().preButtonInput1(keyIsDown, option); - } - } - + public static void MoveKey(Player player, int buttonPressed, Options option){ + if (!FateTypes.isHuman(player) && !((StandUser)player).roundabout$getActive()) + ((IFatePlayer) player).rdbt$getFatePowers().preButtonInput(buttonPressed, option); + else if (!((StandUser) player).roundabout$isSealed() && !((StandUser)player).roundabout$isPossessed()) + ((StandUser) player).roundabout$getStandPowers().preButtonInput(buttonPressed, option); + } } diff --git a/common/src/main/java/net/hydra/jojomod/event/powers/StandPowers.java b/common/src/main/java/net/hydra/jojomod/event/powers/StandPowers.java index 9facfee07..81668663f 100644 --- a/common/src/main/java/net/hydra/jojomod/event/powers/StandPowers.java +++ b/common/src/main/java/net/hydra/jojomod/event/powers/StandPowers.java @@ -16,6 +16,7 @@ import net.hydra.jojomod.event.ModParticles; import net.hydra.jojomod.event.index.*; import net.hydra.jojomod.fates.powers.AbilityScapeBasis; +import net.hydra.jojomod.stand.powers.elements.PowerContext; import net.hydra.jojomod.stand.powers.presets.TWAndSPSharedPowers; import net.hydra.jojomod.item.MaxStandDiscItem; import net.hydra.jojomod.item.ModItems; @@ -381,6 +382,12 @@ public void updateGuard(boolean yeet){ public void updateMove(float flot){ } + /** Stand abilities that the user can use without the stand actively being out (if the config is enabled). **/ + public List standlessAbilities(){ + List $$1 = Lists.newArrayList(); + return $$1; + } + /**If you want something to happen when you spawn a projectile, this is your place. * For instance, you could make every shot out arrow be super thrown, or create a penalty for throwing * a knife*/ @@ -1817,40 +1824,11 @@ public boolean preCanInterruptPower(DamageSource sauce, Entity interrupter, bool } @Override - public void preButtonInput4(boolean keyIsDown, Options options){ - if (hasStandActive(this.getSelf()) && !this.isClashing()) { - if (!((TimeStop)this.getSelf().level()).CanTimeStopEntity(this.getSelf()) && !this.getStandUserSelf().roundabout$isPossessed() ) { - ((StandUser) this.getSelf()).roundabout$setIdleTime(0); - buttonInput4(keyIsDown, options); - } - } - } - @Override - public void preButtonInput3(boolean keyIsDown, Options options){ - if (hasStandActive(this.getSelf()) && !this.isClashing()) { - if (!((TimeStop)this.getSelf().level()).CanTimeStopEntity(this.getSelf()) && !this.getStandUserSelf().roundabout$isPossessed() ) { - ((StandUser) this.getSelf()).roundabout$setIdleTime(0); - buttonInput3(keyIsDown, options); - } - } - } - - @Override - public void preButtonInput2(boolean keyIsDown, Options options){ - if (hasStandActive(this.getSelf()) && !this.isClashing()) { - if (!((TimeStop)this.getSelf().level()).CanTimeStopEntity(this.getSelf()) && !this.getStandUserSelf().roundabout$isPossessed() ) { - ((StandUser) this.getSelf()).roundabout$setIdleTime(0); - buttonInput2(keyIsDown, options); - } - } - } - - @Override - public void preButtonInput1(boolean keyIsDown, Options options){ - if (hasStandActive(this.getSelf()) && !this.isClashing()) { + public void preButtonInput(int buttonPressed, Options options){ + if (hasStandActive(this.getSelf()) || FateTypes.isHuman(this.getSelf()) && !this.isClashing()) { if (!((TimeStop)this.getSelf().level()).CanTimeStopEntity(this.getSelf()) && !this.getStandUserSelf().roundabout$isPossessed() ) { ((StandUser) this.getSelf()).roundabout$setIdleTime(0); - buttonInput1(keyIsDown, options); + buttonInput(buttonPressed, STAND); } } } diff --git a/common/src/main/java/net/hydra/jojomod/fates/powers/AbilityScapeBasis.java b/common/src/main/java/net/hydra/jojomod/fates/powers/AbilityScapeBasis.java index 0933bfd90..5aeed985b 100644 --- a/common/src/main/java/net/hydra/jojomod/fates/powers/AbilityScapeBasis.java +++ b/common/src/main/java/net/hydra/jojomod/fates/powers/AbilityScapeBasis.java @@ -7,6 +7,7 @@ import net.hydra.jojomod.access.IPlayerEntity; import net.hydra.jojomod.client.ClientNetworking; import net.hydra.jojomod.client.KeyInputRegistry; +import net.hydra.jojomod.client.KeyInputs; import net.hydra.jojomod.client.StandIcons; import net.hydra.jojomod.entity.projectile.KnifeEntity; import net.hydra.jojomod.entity.projectile.ThrownObjectEntity; @@ -21,6 +22,7 @@ import net.hydra.jojomod.util.C2SPacketUtil; import net.hydra.jojomod.util.MainUtil; import net.hydra.jojomod.util.S2CPacketUtil; +import net.hydra.jojomod.util.config.ConfigManager; import net.hydra.jojomod.util.gravity.GravityAPI; import net.hydra.jojomod.util.gravity.RotationUtil; import net.minecraft.ChatFormatting; @@ -89,6 +91,12 @@ public AbilityScapeBasis(LivingEntity self) { /**This is when the punch combo goes on cooldown. Default is 3 hit combo.*/ public final byte activePowerPhaseMax = 3; + /** Used to determine which ability set is being used. */ + public final byte + FATE = 1, + STAND = 2; + + /**This variable exists so that a client can begin displaying your attack hud info without ticking through it. * Basically, stand attacks are clientside, but they need the server's confirmation to kickstart so you * can't hit targets in frozen tps*/ @@ -1045,179 +1053,30 @@ public void powerActivate(PowerContext context) { } }; - private boolean held1 = false; - private boolean held2 = false; - private boolean held3 = false; - private boolean held4 = false; - - public void buttonInput1(boolean keyIsDown, Options options) { - if (keyIsDown) - { - if (held1) - return; - held1 = true; - - if (!isHoldingSneak() && !isGuarding()) - { - powerActivate(PowerContext.SKILL_1_NORMAL); - return; - } - if (isHoldingSneak() && !isGuarding()) - { - powerActivate(PowerContext.SKILL_1_CROUCH); - return; - } - if (!isHoldingSneak() && isGuarding()) - { - powerActivate(PowerContext.SKILL_1_GUARD); - return; - } - if (isHoldingSneak() && isGuarding()) - { - powerActivate(PowerContext.SKILL_1_CROUCH_GUARD); - return; - } - } - else - { - held1 = false; - } - } - - public void buttonInput2(boolean keyIsDown, Options options) { - if (keyIsDown) - { - if (held2) - return; - held2 = true; - - if (!isHoldingSneak() && !isGuarding()) - { - powerActivate(PowerContext.SKILL_2_NORMAL); - return; - } - if (isHoldingSneak() && !isGuarding()) - { - powerActivate(PowerContext.SKILL_2_CROUCH); - return; - } - if (!isHoldingSneak() && isGuarding()) - { - powerActivate(PowerContext.SKILL_2_GUARD); - return; - } - if (isHoldingSneak() && isGuarding()) - { - powerActivate(PowerContext.SKILL_2_CROUCH_GUARD); - return; - } - } - else - { - held2 = false; - } - } - - public void buttonInput3(boolean keyIsDown, Options options) { - if (keyIsDown) - { - if (held3) - return; - held3 = true; - - if (!isHoldingSneak() && !isGuarding()) - { - powerActivate(PowerContext.SKILL_3_NORMAL); - return; - } - if (isHoldingSneak() && !isGuarding()) - { - powerActivate(PowerContext.SKILL_3_CROUCH); - return; - } - if (!isHoldingSneak() && isGuarding()) - { - powerActivate(PowerContext.SKILL_3_GUARD); - return; - } - if (isHoldingSneak() && isGuarding()) - { - powerActivate(PowerContext.SKILL_3_CROUCH_GUARD); - return; - } - } - else - { - held3 = false; - } - } - - public void buttonInput4(boolean keyIsDown, Options options) { - if (keyIsDown) - { - if (held4) - return; - held4 = true; - - if (!isHoldingSneak() && !isGuarding()) - { - powerActivate(PowerContext.SKILL_4_NORMAL); - return; - } - if (isHoldingSneak() && !isGuarding()) - { - powerActivate(PowerContext.SKILL_4_CROUCH); - return; - } - if (!isHoldingSneak() && isGuarding()) - { - powerActivate(PowerContext.SKILL_4_GUARD); - return; - } - if (isHoldingSneak() && isGuarding()) - { - powerActivate(PowerContext.SKILL_4_CROUCH_GUARD); - return; - } - } - else - { - held4 = false; - } - } + public void buttonInput(int buttonPressed, int source) { + PowerContext activatedPower; + int power; + if(isHoldingSneak()) + if(isGuarding()) + power = 4; + else power = 2; + else if(isGuarding()) + power = 3; + else power = 1; - public void preButtonInput4(boolean keyIsDown, Options options){ - if (!hasStandActive(this.getSelf())) { - if (!((TimeStop)this.getSelf().level()).CanTimeStopEntity(this.getSelf()) && !this.getStandUserSelf().roundabout$isPossessed() ) { - ((StandUser) this.getSelf()).roundabout$setIdleTime(0); - buttonInput4(keyIsDown, options); - } - } - } - public void preButtonInput3(boolean keyIsDown, Options options){ - if (!hasStandActive(this.getSelf())) { - if (!((TimeStop)this.getSelf().level()).CanTimeStopEntity(this.getSelf()) && !this.getStandUserSelf().roundabout$isPossessed() ) { - ((StandUser) this.getSelf()).roundabout$setIdleTime(0); - buttonInput3(keyIsDown, options); - } - } - } + activatedPower = PowerContext.values()[power + ((buttonPressed - 1) * 4) - 1]; - public void preButtonInput2(boolean keyIsDown, Options options){ - if (!hasStandActive(this.getSelf())) { - if (!((TimeStop)this.getSelf().level()).CanTimeStopEntity(this.getSelf()) && !this.getStandUserSelf().roundabout$isPossessed() ) { - ((StandUser) this.getSelf()).roundabout$setIdleTime(0); - buttonInput2(keyIsDown, options); - } - } + if ((!((StandUser) this.getSelf()).roundabout$getStandPowers().standlessAbilities().contains(activatedPower) || !ConfigManager.getConfig().miscellaneousSettings.standlessAbilities) && source == STAND) + KeyInputs.forceSummon(Minecraft.getInstance().player); + powerActivate(activatedPower); } - public void preButtonInput1(boolean keyIsDown, Options options){ + public void preButtonInput(int buttonPressed, Options options){ if (!hasStandActive(this.getSelf())) { - if (!((TimeStop)this.getSelf().level()).CanTimeStopEntity(this.getSelf()) && !this.getStandUserSelf().roundabout$isPossessed() ) { + if (!((TimeStop)this.getSelf().level()).CanTimeStopEntity(this.getSelf()) && !this.getStandUserSelf().roundabout$isPossessed()) { ((StandUser) this.getSelf()).roundabout$setIdleTime(0); - buttonInput1(keyIsDown, options); + buttonInput(buttonPressed, FATE); } } } diff --git a/common/src/main/java/net/hydra/jojomod/mixin/InputEvents.java b/common/src/main/java/net/hydra/jojomod/mixin/InputEvents.java index 68f1269a1..0fc3d0304 100644 --- a/common/src/main/java/net/hydra/jojomod/mixin/InputEvents.java +++ b/common/src/main/java/net/hydra/jojomod/mixin/InputEvents.java @@ -85,6 +85,13 @@ public abstract class InputEvents implements IInputEvents { @Unique public Level roundabout$playerlev; + private boolean[] heldKeys = { + false, + false, + false, + false + }; + protected InputEvents() { } @@ -967,17 +974,14 @@ private void handleKeybinds() { ((StandUser)player).roundabout$getStandPowers().visualFrameTick(); if (rdbt$isInitialized(player)) { - KeyInputs.MoveKey1(player, ((Minecraft) (Object) this), roundabout$sameKeyOne(KeyInputRegistry.abilityOneKey), - this.options); - - KeyInputs.MoveKey2(player, ((Minecraft) (Object) this), roundabout$sameKeyOne(KeyInputRegistry.abilityTwoKey), - this.options); - - KeyInputs.MoveKey3(player, ((Minecraft) (Object) this), roundabout$sameKeyOne(KeyInputRegistry.abilityThreeKey), - this.options); - - KeyInputs.MoveKey4(player, ((Minecraft) (Object) this), roundabout$sameKeyOne(KeyInputRegistry.abilityFourKey), - this.options); + for (int i = 0; i < KeyInputRegistry.abilityKeyList.length; i++) { + if (roundabout$sameKeyOne(KeyInputRegistry.abilityKeyList[i])) { + if (!heldKeys[i]) { + heldKeys[i] = true; + KeyInputs.MoveKey(player, i + 1, this.options); + } + } else heldKeys[i] = false; + } } KeyInputs.showEXPKey(player,((Minecraft) (Object) this), roundabout$sameKeyThree(KeyInputRegistry.showExp), diff --git a/common/src/main/java/net/hydra/jojomod/stand/powers/PowersKillerQueen.java b/common/src/main/java/net/hydra/jojomod/stand/powers/PowersKillerQueen.java index 0fbf7656b..1ae00f531 100644 --- a/common/src/main/java/net/hydra/jojomod/stand/powers/PowersKillerQueen.java +++ b/common/src/main/java/net/hydra/jojomod/stand/powers/PowersKillerQueen.java @@ -232,9 +232,13 @@ public boolean tryBlockPosPower(int move, boolean forced, BlockPos blockPos){ @Override - public void buttonInput2(boolean KeyIsDown, Options options) { - + public void buttonInput(int buttonPressed, int source) { + if (buttonPressed == 2){ + + } + else super.buttonInput(buttonPressed, source); } + @Override public void renderIcons(GuiGraphics context, int x, int y) { diff --git a/common/src/main/java/net/hydra/jojomod/stand/powers/PowersMagiciansRed.java b/common/src/main/java/net/hydra/jojomod/stand/powers/PowersMagiciansRed.java index 61912d82e..1ab7b0ba7 100644 --- a/common/src/main/java/net/hydra/jojomod/stand/powers/PowersMagiciansRed.java +++ b/common/src/main/java/net/hydra/jojomod/stand/powers/PowersMagiciansRed.java @@ -706,6 +706,13 @@ public int getRangedBarrage2Length(){ return 60; } + @Override + public List standlessAbilities(){ + List $$1 = Lists.newArrayList(); + $$1.add(PowerContext.SKILL_3_CROUCH); + return $$1; + } + @Override public void renderAttackHud(GuiGraphics context, Player playerEntity, int scaledWidth, int scaledHeight, int ticks, int vehicleHeartCount, diff --git a/common/src/main/java/net/hydra/jojomod/stand/powers/presets/TWAndSPSharedPowers.java b/common/src/main/java/net/hydra/jojomod/stand/powers/presets/TWAndSPSharedPowers.java index 8e8650a2a..7f9eeff09 100644 --- a/common/src/main/java/net/hydra/jojomod/stand/powers/presets/TWAndSPSharedPowers.java +++ b/common/src/main/java/net/hydra/jojomod/stand/powers/presets/TWAndSPSharedPowers.java @@ -785,11 +785,13 @@ public boolean clientForwardBarrage(){ } @Override - public void preButtonInput4(boolean keyIsDown, Options options){ - if (hasStandActive(this.getSelf()) && !this.isClashing()) { - ((StandUser) this.getSelf()).roundabout$setIdleTime(0); - buttonInput4(keyIsDown, options); - } + public void preButtonInput(int buttonPressed, Options options){ + if (buttonPressed == 4){ + if (hasStandActive(this.getSelf()) && !this.isClashing()) { + ((StandUser) this.getSelf()).roundabout$setIdleTime(0); + buttonInput(buttonPressed, STAND); + } + } else super.preButtonInput(buttonPressed, options); } diff --git a/common/src/main/java/net/hydra/jojomod/util/config/Config.java b/common/src/main/java/net/hydra/jojomod/util/config/Config.java index 07d50c7f3..0b6ff88f4 100644 --- a/common/src/main/java/net/hydra/jojomod/util/config/Config.java +++ b/common/src/main/java/net/hydra/jojomod/util/config/Config.java @@ -171,6 +171,8 @@ public static class MiscSettings { public Boolean disableBleedingAndBloodSplatters; @BooleanOption(group = "inherit", value = false) public Boolean banDirectionalBlockPlacingFailure; + @BooleanOption(group = "inherit", value = false) + public Boolean standlessAbilities; } public static class VampireSettings { @BooleanOption(group = "inherit", value = false) diff --git a/common/src/main/resources/assets/roundabout/lang/en_us.json b/common/src/main/resources/assets/roundabout/lang/en_us.json index 469423db5..9186e6240 100644 --- a/common/src/main/resources/assets/roundabout/lang/en_us.json +++ b/common/src/main/resources/assets/roundabout/lang/en_us.json @@ -2297,6 +2297,8 @@ "config.roundabout.generalDetectionGoThroughDoorsAndCorners.desc": "Some of the mod's area of affect or line of sight mechanics stop when they hit a block, turning this off lets you hit past corners and doors with certain things. Not recommended.", "config.roundabout.disableBleedingAndBloodSplatters.name": "Disable Blood", "config.roundabout.disableBleedingAndBloodSplatters.desc": "If you are sensitive to blood, this setting might help.", + "config.roundabout.standlessAbilities.name": "Stand Abilities Without Stand Summoned", + "config.roundabout.standlessAbilities.desc": "If this is enabled, certain stand abilities can be used without summoning the stand.", "config.roundabout.major.done": "Done", "config.roundabout.major.reset": "Reset",