示例#1
0
 /**
  * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they
  * intersect the mask.) Parameters: World, X, Y, Z, mask, list, colliding entity
  */
 @Override
 public void addCollisionBoxesToList(
     World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) {
   this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F);
   super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
   float f = 0.125F;
   this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
   super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
   this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
   super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
   this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
   super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
   this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
   super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
   this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
 }
示例#2
0
  /** Called when the block is placed in the world. */
  @Override
  public void onBlockPlacedBy(
      World world, int x, int y, int z, EntityLivingBase entity, ItemStack is) {
    super.onBlockPlacedBy(world, x, y, z, entity, is);

    if (is.hasDisplayName()) {
      TEHopper tileentityhopper = getHopperTE(world, x, y, z);
      tileentityhopper.setCustomName(is.getDisplayName());
    }
  }
示例#3
0
 /** Ticks the block if it's been scheduled */
 @Override
 public void updateTick(World world, int x, int y, int z, Random rand) {
   super.updateTick(world, x, y, z, rand);
   int meta = world.getBlockMetadata(x, y, z);
   if (meta < 8) {
     TEOilLamp te = (TEOilLamp) world.getTileEntity(x, y, z);
     if (te != null) {
       te.updateLampFuel(true); // Burn fuel for time passed while lamp is on.
       if (te.getFuelTimeLeft() == 0) world.setBlockMetadataWithNotify(x, y, z, meta + 8, 3);
     }
   }
 }
示例#4
0
  @Override
  public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
    if (world.getTileEntity(x, y, z) instanceof TEHopper) {
      TEHopper te = (TEHopper) world.getTileEntity(x, y, z);

      for (int i1 = 0; i1 < te.getSizeInventory(); ++i1) {
        ItemStack itemstack = te.getStackInSlot(i1);

        if (itemstack != null) {
          while (itemstack.stackSize > 0) {
            int j1 = this.random.nextInt(21) + 10;

            if (j1 > itemstack.stackSize) {
              j1 = itemstack.stackSize;
            }

            itemstack.stackSize -= j1;
            EntityItem entityitem =
                new EntityItem(
                    world,
                    x + 0.5f,
                    y + 0.5f,
                    z + 0.5f,
                    new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));

            if (itemstack.hasTagCompound()) {
              entityitem
                  .getEntityItem()
                  .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
            }

            // float f3 = 0.05F;
            world.spawnEntityInWorld(entityitem);
          }
        }
      }
      if (te.pressBlock != null) {
        EntityItem entityitem = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, te.pressBlock);
        world.spawnEntityInWorld(entityitem);
      }
      world.func_147453_f(x, y, z, block);
    }

    super.breakBlock(world, x, y, z, block, meta);
  }
示例#5
0
 /** Called whenever the block is added into the world. Args: world, x, y, z */
 @Override
 public void onBlockAdded(World world, int x, int y, int z) {
   super.onBlockAdded(world, x, y, z);
   this.updatePowerState(world, x, y, z);
 }