Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
71 changes: 15 additions & 56 deletions common/src/main/java/net/hydra/jojomod/client/KeyInputs.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

}
}
}
}
Expand All @@ -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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<PowerContext> standlessAbilities(){
List<PowerContext> $$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*/
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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*/
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
Loading