Posted July 6, 20169 yr Hello. I have an event that tells me if certain keys are down. They work as intended in the workspace, but for some reason, outside of the workspace, isKeyDown() is never true. my event code: @SubscribeEvent public void handleClientTick(ClientTickEvent event) { if (Minecraft.getMinecraft().inGameHasFocus && Minecraft.getMinecraft().thePlayer != null) { Minecraft.getMinecraft().thePlayer.worldObj.spawnParticle(EnumParticleTypes.SWEEP_ATTACK, Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY + 2, Minecraft.getMinecraft().thePlayer.posZ, 0, 0, 0, new int[0]); } if (checkIfPlayer()) { Minecraft.getMinecraft().thePlayer.worldObj.spawnParticle(EnumParticleTypes.CLOUD, Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY + 2, Minecraft.getMinecraft().thePlayer.posZ, 0, 0, 0, new int[0]); Entity dragon = Minecraft.getMinecraft().thePlayer.getRidingEntity(); if (Minecraft.getMinecraft().gameSettings.keyBindJump.isKeyDown()) { IceAndFire.NETWORK_WRAPPER.sendToServer(new MessageDragonKeys(dragon.getEntityId(), 0)); } if (Minecraft.getMinecraft().gameSettings.keyBindSneak.isKeyDown()) { Minecraft.getMinecraft().thePlayer.worldObj.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY + 2, Minecraft.getMinecraft().thePlayer.posZ, 0, 0, 0, new int[0]); IceAndFire.NETWORK_WRAPPER.sendToServer(new MessageDragonKeys(dragon.getEntityId(), 1)); } if (ModKeys.dragon_fireAttack.isKeyDown()) { IceAndFire.NETWORK_WRAPPER.sendToServer(new MessageDragonKeys(dragon.getEntityId(), 2)); } if (ModKeys.dragon_strike.isKeyDown()) { IceAndFire.NETWORK_WRAPPER.sendToServer(new MessageDragonKeys(dragon.getEntityId(), 3)); } if (ModKeys.dragon_dismount.isKeyDown()) { IceAndFire.NETWORK_WRAPPER.sendToServer(new MessageDragonKeys(dragon.getEntityId(), 4)); } } } public boolean checkIfPlayer() { if (Minecraft.getMinecraft().inGameHasFocus && Minecraft.getMinecraft().thePlayer != null) { return Minecraft.getMinecraft().thePlayer.ticksExisted % 2 == 0 && Minecraft.getMinecraft().thePlayer.worldObj.isRemote && Minecraft.getMinecraft().thePlayer.getRidingEntity() != null && Minecraft.getMinecraft().thePlayer.getRidingEntity() instanceof EntityDragonBase; } else { return false; } } The farthest particle that spawns is the CLOUD, meaning that the event is working but the keys are not working.
July 8, 20169 yr Author May or may not be related: the entity in the mod is controllable in the workspace but not outside of it.
July 8, 20169 yr 1st of all - THIS! public void handleClientTick(ClientTickEvent event) { Minecraft mc = Minecraft.getMinecraft(); EntityPlayer player = mc.thePlayer; if (mc.inGameHasFocus && player != null) { player.worldObj.spawnParticle(EnumParticleTypes.SWEEP_ATTACK, player.posX, player.posY + 2, player.posZ, 0, 0, 0, new int[0]); if (ticksExisted % 2 == 0 && player.getRidingEntity() instanceof EntityDragonBase) { Entity dragon = player.getRidingEntity(); player.worldObj.spawnParticle(EnumParticleTypes.CLOUD, player.posX, player.posY + 2, player.posZ, 0, 0, 0, new int[0]); if (mc.gameSettings.keyBindJump.isKeyDown()) { IceAndFire.NETWORK_WRAPPER.sendToServer(new MessageDragonKeys(dragon.getEntityId(), 0)); } if (mc.gameSettings.keyBindSneak.isKeyDown()) { player.worldObj.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, player.posX, player.posY + 2, player.posZ, 0, 0, 0, new int[0]); IceAndFire.NETWORK_WRAPPER.sendToServer(new MessageDragonKeys(dragon.getEntityId(), 1)); } if (ModKeys.dragon_fireAttack.isKeyDown()) { IceAndFire.NETWORK_WRAPPER.sendToServer(new MessageDragonKeys(dragon.getEntityId(), 2)); } if (ModKeys.dragon_strike.isKeyDown()) { IceAndFire.NETWORK_WRAPPER.sendToServer(new MessageDragonKeys(dragon.getEntityId(), 3)); } if (ModKeys.dragon_dismount.isKeyDown()) { IceAndFire.NETWORK_WRAPPER.sendToServer(new MessageDragonKeys(dragon.getEntityId(), 4)); } } } } FASTER. CLEANER. BETTER. 2nd: Server alredy knows about sneak key being pressed (boolean in EntityPlayer I think, like #isSneaking()). I think server also knows about space but idk, probably. As to 3 others - they don't work meaning if statement doesn't pass or what? 1.7.10 is no longer supported by forge, you are on your own.
July 9, 20169 yr Author 2. yes I know but I want to cancel out all other mod's shift behaviors at the time as well. 3. It only gets to the smoke particle spawn meaning "if (mc.gameSettings.keyBindJump.isKeyDown())" is never true.
July 10, 20169 yr Author After more checking this and the unfunctional riding controls seem to be the only disconnects i could find.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.