Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
  @Override
  public void updateInPedestal(World world, int x, int y, int z) {
    if (!world.isRemote && ProjectEConfig.ignitePedCooldown != -1) {
      DMPedestalTile tile = ((DMPedestalTile) world.getTileEntity(x, y, z));
      if (tile.getActivityCooldown() == 0) {
        List<EntityLiving> list =
            world.getEntitiesWithinAABB(EntityLiving.class, tile.getEffectBounds());
        for (EntityLiving living : list) {
          living.attackEntityFrom(DamageSource.inFire, 3.0F);
          living.setFire(8);
        }

        tile.setActivityCooldown(ProjectEConfig.ignitePedCooldown);
      } else {
        tile.decrementActivityCooldown();
      }
    }
  }
Ejemplo n.º 3
0
 @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();
     }
   }
 }
Ejemplo n.º 4
0
 public boolean onBlockActivated(
     World world,
     int x,
     int y,
     int z,
     EntityPlayer player,
     int side,
     float hitX,
     float hitY,
     float hitZ) {
   if (!world.isRemote) {
     DMPedestalTile tile = ((DMPedestalTile) world.getTileEntity(x, y, z));
     if (player.isSneaking()) {
       player.openGui(PECore.instance, Constants.PEDESTAL_GUI, world, x, y, z);
     } else {
       if (tile.getItemStack() != null && tile.getItemStack().getItem() instanceof IPedestalItem) {
         tile.setActive(!tile.getActive());
       }
       PELogger.logDebug("Pedestal: " + (tile.getActive() ? "ON" : "OFF"));
     }
     PacketHandler.sendToAllAround(
         new ClientSyncPedestalPKT(tile),
         new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32));
   }
   return true;
 }