diff --git a/src/main/java/taintedmagic/common/items/ItemFlyteCharm.java b/src/main/java/taintedmagic/common/items/ItemFlyteCharm.java index 9ddb3d3..d7fd90a 100644 --- a/src/main/java/taintedmagic/common/items/ItemFlyteCharm.java +++ b/src/main/java/taintedmagic/common/items/ItemFlyteCharm.java @@ -1,15 +1,9 @@ package taintedmagic.common.items; -import java.util.HashMap; -import java.util.UUID; - -import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; -import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; @@ -25,8 +19,6 @@ import net.minecraftforge.event.entity.living.LivingEvent; import taintedmagic.api.IRenderInventoryItem; import taintedmagic.common.TaintedMagic; import taintedmagic.common.helper.TaintedMagicHelper; -import taintedmagic.common.network.PacketHandler; -import taintedmagic.common.network.PacketUpdateJumpKey; import thaumcraft.api.IWarpingGear; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; @@ -42,9 +34,6 @@ public class ItemFlyteCharm extends Item implements IWarpingGear, IRenderInvento // Magic circle texture private static final ResourceLocation MAGIC_CIRCLE = new ResourceLocation("taintedmagic:textures/misc/circle.png"); - // Stores whether the player has their jump key down (for boost function) - public static HashMap jumpKeyState = new HashMap(); - public ItemFlyteCharm () { this.setCreativeTab(TaintedMagic.tabTM); @@ -92,13 +81,6 @@ public class ItemFlyteCharm extends Item implements IWarpingGear, IRenderInvento player.motionX += Math.cos(Math.toRadians(player.rotationYawHead + 90)) * speed; player.motionZ += Math.sin(Math.toRadians(player.rotationYawHead + 90)) * speed; } - - // Boost - if (!player.isSneaking() && jumpKeyState.containsKey(player.getUniqueID()) - && jumpKeyState.get(player.getUniqueID()) - && TaintedMagicHelper.consumeVisFromInventory(player, COST_BOOST, player.motionY > 0.2)) - player.motionY = Math.min(player.motionY + 0.2D, 0.6D); - } // Speed boost if (player.moveForward > 0.0F) @@ -115,40 +97,6 @@ public class ItemFlyteCharm extends Item implements IWarpingGear, IRenderInvento } } - @SubscribeEvent - public void onPlayerLoggedOut (PlayerLoggedInEvent event) - { - // Remove the player from the HashMap - if (jumpKeyState.containsKey(event.player.getUniqueID())) jumpKeyState.remove(event.player.getUniqueID()); - } - - /** - * Updates the player's jump key status & syncs it to the server - * - * @param event - */ - @SubscribeEvent - @SideOnly (Side.CLIENT) - public void playerTick (ClientTickEvent event) - { - EntityPlayer player = TaintedMagic.proxy.getClientPlayer(); - if (player != null) - { - UUID uuid = player.getUniqueID(); - if (shouldPlayerHaveFlight(player)) - { - boolean state = Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed(); - if (jumpKeyState.containsKey(uuid) && jumpKeyState.get(uuid) != state) - { - jumpKeyState.replace(uuid, state); - PacketHandler.INSTANCE.sendToServer(new PacketUpdateJumpKey(uuid, state)); - } - else jumpKeyState.put(uuid, state); - } - else jumpKeyState.remove(uuid); - } - } - /** * Determines if the player should be able to fly. * diff --git a/src/main/java/taintedmagic/common/network/PacketHandler.java b/src/main/java/taintedmagic/common/network/PacketHandler.java index eb3d85e..d982170 100644 --- a/src/main/java/taintedmagic/common/network/PacketHandler.java +++ b/src/main/java/taintedmagic/common/network/PacketHandler.java @@ -12,6 +12,5 @@ public class PacketHandler public static void initPackets () { INSTANCE.registerMessage(PacketKatanaAttack.class, PacketKatanaAttack.class, 0, Side.SERVER); - INSTANCE.registerMessage(PacketUpdateJumpKey.class, PacketUpdateJumpKey.class, 1, Side.SERVER); } } diff --git a/src/main/java/taintedmagic/common/network/PacketUpdateJumpKey.java b/src/main/java/taintedmagic/common/network/PacketUpdateJumpKey.java deleted file mode 100644 index 2833d09..0000000 --- a/src/main/java/taintedmagic/common/network/PacketUpdateJumpKey.java +++ /dev/null @@ -1,49 +0,0 @@ -package taintedmagic.common.network; - -import java.util.UUID; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import io.netty.buffer.ByteBuf; -import taintedmagic.common.items.ItemFlyteCharm; - -public class PacketUpdateJumpKey implements IMessage, IMessageHandler -{ - private long leastSigBits, mostSigBits; - private boolean state; - - public PacketUpdateJumpKey () - { - } - - public PacketUpdateJumpKey (UUID uuid, boolean state) - { - this.leastSigBits = uuid.getLeastSignificantBits(); - this.mostSigBits = uuid.getMostSignificantBits(); - this.state = state; - } - - @Override - public IMessage onMessage (PacketUpdateJumpKey message, MessageContext ctx) - { - ItemFlyteCharm.jumpKeyState.replace(new UUID(message.leastSigBits, message.mostSigBits), message.state); - return null; - } - - @Override - public void fromBytes (ByteBuf buf) - { - this.leastSigBits = buf.readLong(); - this.mostSigBits = buf.readLong(); - this.state = buf.readBoolean(); - } - - @Override - public void toBytes (ByteBuf buf) - { - buf.writeLong(leastSigBits); - buf.writeLong(mostSigBits); - buf.writeBoolean(state); - } -}