public void breakBlock(World world, int x, int y, int z, Block block, int meta) { DMPedestalTile tile = ((DMPedestalTile) world.getTileEntity(x, y, z)); if (tile.getItemStack() != null) { WorldHelper.spawnEntityItem(world, tile.getItemStack().copy(), x, y, z); } tile.invalidate(); super.breakBlock(world, x, y, z, block, meta); }
@Override public void onUpdate( ItemStack stack, World world, Entity entity, int inventorySlot, boolean par5) { if (world.isRemote || inventorySlot > 8 || !(entity instanceof EntityPlayer)) return; super.onUpdate(stack, world, entity, inventorySlot, par5); EntityPlayerMP player = (EntityPlayerMP) entity; if (stack.getItemDamage() != 0) { if (getEmc(stack) == 0 && !consumeFuel(player, stack, 64, false)) { stack.setItemDamage(0); } else { WorldHelper.igniteNearby(world, player); removeEmc(stack, 0.32F); } } else { WorldHelper.extinguishNearby(world, player); } }
@Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if (!world.isRemote) { int offset = 3 + this.getCharge(stack); AxisAlignedBB box = player.boundingBox.expand(offset, offset, offset); world.playSoundAtEntity(player, "projecte:item.pepower", 1.0F, 1.0F); WorldHelper.freezeInBoundingBox(world, box); } return stack; }
@Override public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { super.onUpdate(stack, world, entity, par4, par5); if (world.isRemote || par4 > 8 || stack.getItemDamage() == 0) { return; } AxisAlignedBB box = AxisAlignedBB.getBoundingBox( entity.posX - 3, entity.posY - 3, entity.posZ - 3, entity.posX + 3, entity.posY + 3, entity.posZ + 3); WorldHelper.freezeInBoundingBox(world, box); }
@Override public void updateInPedestal(World world, int x, int y, int z) { if (!world.isRemote && ProjectEConfig.zeroPedCooldown != -1) { if (coolCooldown == 0) { TileEntity tile = world.getTileEntity(x, y, z); AxisAlignedBB aabb = ((DMPedestalTile) tile).getEffectBounds(); WorldHelper.freezeInBoundingBox(world, aabb); List<Entity> list = world.getEntitiesWithinAABB(Entity.class, aabb); for (Entity ent : list) { if (ent.isBurning()) { ent.extinguish(); } } coolCooldown = ProjectEConfig.zeroPedCooldown; } else { coolCooldown--; } } }
@Override public void updateInPedestal(@Nonnull World world, @Nonnull BlockPos pos) { if (!world.isRemote && ProjectEConfig.zeroPedCooldown != -1) { DMPedestalTile tile = ((DMPedestalTile) world.getTileEntity(pos)); if (tile.getActivityCooldown() == 0) { AxisAlignedBB aabb = tile.getEffectBounds(); WorldHelper.freezeInBoundingBox(world, aabb, null, false); List<Entity> list = world.getEntitiesWithinAABB(Entity.class, aabb); for (Entity ent : list) { if (ent.isBurning()) { ent.extinguish(); } } tile.setActivityCooldown(ProjectEConfig.zeroPedCooldown); } else { tile.decrementActivityCooldown(); } } }
@Nonnull @Override public ActionResult<ItemStack> onItemRightClick( @Nonnull ItemStack stack, World world, EntityPlayer player, EnumHand hand) { if (!world.isRemote) { int offset = 3 + this.getCharge(stack); AxisAlignedBB box = player.getEntityBoundingBox().expand(offset, offset, offset); world.playSound( null, player.posX, player.posY, player.posZ, PESounds.POWER, SoundCategory.PLAYERS, 1.0F, 1.0F); WorldHelper.freezeInBoundingBox(world, box, player, false); } return ActionResult.newResult(EnumActionResult.SUCCESS, stack); }