mirror of
https://github.com/GTNewHorizons/ThaumicHorizons.git
synced 2026-10-26 14:33:47 +00:00
Continue flattening code
This commit is contained in:
1 file changed
+73
-92
@@ -74,23 +74,24 @@ public class THKeyHandler {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void playerTick(final TickEvent.PlayerTickEvent event) {
|
||||
if (event.side != Side.CLIENT || event.phase != TickEvent.Phase.START) return;
|
||||
if (event.side != Side.CLIENT || event.phase != TickEvent.Phase.START || event.player == null) return;
|
||||
|
||||
final EntityPlayer player = event.player;
|
||||
final EntityInfusionProperties infusions = (EntityInfusionProperties) player
|
||||
.getExtendedProperties("CreatureInfusion");
|
||||
|
||||
if (this.keyV.getIsKeyPressed()) {
|
||||
if (FMLClientHandler.instance().getClient().inGameHasFocus) {
|
||||
final EntityPlayer player = event.player;
|
||||
if (player != null) {
|
||||
if (!this.keyPressedV) {
|
||||
THKeyHandler.lastPressV = System.currentTimeMillis();
|
||||
THKeyHandler.radialLock = false;
|
||||
}
|
||||
if (!THKeyHandler.radialLock && player.inventory.armorItemInSlot(3) != null
|
||||
&& player.inventory.armorItemInSlot(3).getItem() instanceof IRevealer) {
|
||||
if (player.isSneaking()) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketLensChangeToServer(player, "REMOVE"));
|
||||
} else {
|
||||
THKeyHandler.radialActive = true;
|
||||
}
|
||||
if (!this.keyPressedV) {
|
||||
THKeyHandler.lastPressV = System.currentTimeMillis();
|
||||
THKeyHandler.radialLock = false;
|
||||
}
|
||||
if (!THKeyHandler.radialLock && player.inventory.armorItemInSlot(3) != null
|
||||
&& player.inventory.armorItemInSlot(3).getItem() instanceof IRevealer) {
|
||||
if (player.isSneaking()) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketLensChangeToServer(player, "REMOVE"));
|
||||
} else {
|
||||
THKeyHandler.radialActive = true;
|
||||
}
|
||||
}
|
||||
this.keyPressedV = true;
|
||||
@@ -105,22 +106,18 @@ public class THKeyHandler {
|
||||
|
||||
if (this.keyM.getIsKeyPressed()) {
|
||||
if (FMLClientHandler.instance().getClient().inGameHasFocus) {
|
||||
final EntityPlayer player = event.player;
|
||||
if (player != null) {
|
||||
if (!this.keyPressedM) {
|
||||
THKeyHandler.lastPressM = System.currentTimeMillis();
|
||||
}
|
||||
if (((EntityInfusionProperties) player.getExtendedProperties("CreatureInfusion"))
|
||||
.hasPlayerInfusion(2) && !this.keyPressedM) {
|
||||
player.openGui(
|
||||
ThaumicHorizons.instance,
|
||||
9,
|
||||
player.worldObj,
|
||||
(int) player.posX,
|
||||
(int) player.posY,
|
||||
(int) player.posZ);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketFingersToServer(player, player.dimension));
|
||||
}
|
||||
if (!this.keyPressedM) {
|
||||
THKeyHandler.lastPressM = System.currentTimeMillis();
|
||||
}
|
||||
if (infusions.hasPlayerInfusion(2) && !this.keyPressedM) {
|
||||
player.openGui(
|
||||
ThaumicHorizons.instance,
|
||||
9,
|
||||
player.worldObj,
|
||||
(int) player.posX,
|
||||
(int) player.posY,
|
||||
(int) player.posZ);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketFingersToServer(player, player.dimension));
|
||||
}
|
||||
this.keyPressedM = true;
|
||||
}
|
||||
@@ -133,33 +130,25 @@ public class THKeyHandler {
|
||||
|
||||
if (this.keyC.getIsKeyPressed()) {
|
||||
if (FMLClientHandler.instance().getClient().inGameHasFocus) {
|
||||
final EntityPlayer player = event.player;
|
||||
if (player != null) {
|
||||
if (!this.keyPressedC) {
|
||||
THKeyHandler.lastPressC = System.currentTimeMillis();
|
||||
}
|
||||
if (((EntityInfusionProperties) player.getExtendedProperties("CreatureInfusion"))
|
||||
.hasPlayerInfusion(9) && !this.keyPressedC) {
|
||||
((EntityInfusionProperties) player.getExtendedProperties(
|
||||
"CreatureInfusion")).toggleClimb = !((EntityInfusionProperties) player
|
||||
.getExtendedProperties("CreatureInfusion")).toggleClimb;
|
||||
if (((EntityInfusionProperties) player
|
||||
.getExtendedProperties("CreatureInfusion")).toggleClimb) {
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(
|
||||
EnumChatFormatting.ITALIC + ""
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ "Spider Climb disabled."));
|
||||
} else {
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(
|
||||
EnumChatFormatting.ITALIC + ""
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ "Spider Climb enabled."));
|
||||
}
|
||||
PacketHandler.INSTANCE
|
||||
.sendToServer(new PacketToggleClimbToServer(player, player.dimension));
|
||||
if (!this.keyPressedC) {
|
||||
THKeyHandler.lastPressC = System.currentTimeMillis();
|
||||
}
|
||||
if (infusions.hasPlayerInfusion(9) && !this.keyPressedC) {
|
||||
infusions.toggleClimb = !infusions.toggleClimb;
|
||||
if (infusions.toggleClimb) {
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(
|
||||
EnumChatFormatting.ITALIC + ""
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ "Spider Climb disabled."));
|
||||
} else {
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(
|
||||
EnumChatFormatting.ITALIC + ""
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ "Spider Climb enabled."));
|
||||
}
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketToggleClimbToServer(player, player.dimension));
|
||||
}
|
||||
this.keyPressedC = true;
|
||||
}
|
||||
@@ -172,43 +161,35 @@ public class THKeyHandler {
|
||||
|
||||
if (this.keyX.getIsKeyPressed()) {
|
||||
if (FMLClientHandler.instance().getClient().inGameHasFocus) {
|
||||
final EntityPlayer player = event.player;
|
||||
if (player != null) {
|
||||
if (!this.keyPressedX) {
|
||||
THKeyHandler.lastPressX = System.currentTimeMillis();
|
||||
}
|
||||
if (((EntityInfusionProperties) player.getExtendedProperties("CreatureInfusion"))
|
||||
.hasPlayerInfusion(10) && !this.keyPressedX) {
|
||||
((EntityInfusionProperties) player.getExtendedProperties(
|
||||
"CreatureInfusion")).toggleInvisible = !((EntityInfusionProperties) player
|
||||
.getExtendedProperties("CreatureInfusion")).toggleInvisible;
|
||||
if (((EntityInfusionProperties) player
|
||||
.getExtendedProperties("CreatureInfusion")).toggleInvisible) {
|
||||
player.removePotionEffectClient(Potion.invisibility.id);
|
||||
player.setInvisible(false);
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(
|
||||
EnumChatFormatting.ITALIC + ""
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ "Chameleon Skin disabled."));
|
||||
} else {
|
||||
final PotionEffect effect = new PotionEffect(
|
||||
Potion.invisibility.id,
|
||||
Integer.MAX_VALUE,
|
||||
0,
|
||||
true);
|
||||
effect.setCurativeItems(new ArrayList<>());
|
||||
player.addPotionEffect(effect);
|
||||
player.setInvisible(true);
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(
|
||||
EnumChatFormatting.ITALIC + ""
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ "Chameleon Skin enabled."));
|
||||
}
|
||||
PacketHandler.INSTANCE
|
||||
.sendToServer(new PacketToggleInvisibleToServer(player, player.dimension));
|
||||
if (!this.keyPressedX) {
|
||||
THKeyHandler.lastPressX = System.currentTimeMillis();
|
||||
}
|
||||
if (infusions.hasPlayerInfusion(10) && !this.keyPressedX) {
|
||||
infusions.toggleInvisible = !infusions.toggleInvisible;
|
||||
if (infusions.toggleInvisible) {
|
||||
player.removePotionEffectClient(Potion.invisibility.id);
|
||||
player.setInvisible(false);
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(
|
||||
EnumChatFormatting.ITALIC + ""
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ "Chameleon Skin disabled."));
|
||||
} else {
|
||||
final PotionEffect effect = new PotionEffect(
|
||||
Potion.invisibility.id,
|
||||
Integer.MAX_VALUE,
|
||||
0,
|
||||
true);
|
||||
effect.setCurativeItems(new ArrayList<>());
|
||||
player.addPotionEffect(effect);
|
||||
player.setInvisible(true);
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(
|
||||
EnumChatFormatting.ITALIC + ""
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ "Chameleon Skin enabled."));
|
||||
}
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketToggleInvisibleToServer(player, player.dimension));
|
||||
}
|
||||
this.keyPressedX = true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user