@SubscribeEvent public void onEntityJump(LivingJumpEvent e) { if (e.getEntity().getEntityWorld().getBlockState(new BlockPos((int) Math.floor(e.getEntity().posX), (int) Math.floor(e.getEntity().posY) - 1, (int) Math.floor(e.getEntity().posZ))).getBlock() == this) e.getEntityLiving().motionY = 0D; } }
@SubscribeEvent public void onPlayerJump(LivingJumpEvent event) { World world = event.getEntity().world; if (!world.isRemote && event.getEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.getEntity(); if (!player.isCreative()) { ThirstHandler thirstStats = (ThirstHandler) player.getCapability(TANCapabilities.THIRST, null); if (player.isSprinting()) { thirstStats.addExhaustion(0.8F); } else { thirstStats.addExhaustion(0.2F); } } } }
public void onEntityJump(LivingEvent.LivingJumpEvent event) { if (!event.getEntity().world.isRemote) { extractEnergyScaled(ENERGY_PER_JUMP); } }
@SubscribeEvent public static void onEntityJump(LivingJumpEvent event) { if(event.getEntityLiving() instanceof EntityPlayer && event.getEntity().world.isRemote) { EntityPlayer player = (EntityPlayer) event.getEntityLiving(); PsiArmorEvent.post(new PsiArmorEvent(player, PsiArmorEvent.JUMP)); NetworkHandler.INSTANCE.sendToServer(new MessageTriggerJumpSpell()); } }
@SubscribeEvent public void onLivingJump(LivingEvent.LivingJumpEvent event) { if(event.getEntity() == null) { return; } // check if we jumped from a slime block BlockPos pos = new BlockPos(event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ); if(event.getEntity().getEntityWorld().isAirBlock(pos)) { pos = pos.down(); } IBlockState state = event.getEntity().getEntityWorld().getBlockState(pos); Block block = state.getBlock(); if(block == TinkerCommons.blockSlimeCongealed) { bounce(event.getEntity(), 0.25f); } else if(block == TinkerCommons.blockSoil) { if(state.getValue(BlockSoil.TYPE) == BlockSoil.SoilTypes.SLIMY_MUD_GREEN || state.getValue(BlockSoil.TYPE) == BlockSoil.SoilTypes.SLIMY_MUD_BLUE) { bounce(event.getEntity(), 0.15f); } } else if(worldLoaded && (block == TinkerWorld.slimeDirt || block == TinkerWorld.slimeGrass)) { bounce(event.getEntity(), 0.06f); } }