Пример #1
0
 @Override
 public void onBlockPlacedBy(
     World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
   int metadata = world.getBlockMetadata(x, y, z);
   ForgeDirection side = ForgeDirection.getOrientation((metadata & 3) + 2);
   AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(0, 0, 0, 2, 3, 2);
   if ((metadata & Door.FLAG_TOPBLOCK) == 0) aabb.offset(0, -2, 0);
   MultiBlock mb = new MultiBlock(world, x, y, z);
   mb.setDirection(side);
   mb.setBounds(aabb);
   if (!mb.placeBlocks()) itemStack.stackSize++;
 }
Пример #2
0
  @Override
  public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) {
    RustyHatchTileEntity te =
        MultiBlock.getOriginProvider(RustyHatchTileEntity.class, world, x, y, z);
    if (te == null) return false;

    return te.shouldLadder(x, y, z);
  }
  @Override
  public AxisAlignedBB getBoundingBox(
      DoorTileEntity tileEntity, boolean topBlock, BoundingBoxType type) {
    if (!(tileEntity instanceof ForcefieldTileEntity)) return null;

    if (type == BoundingBoxType.COLLISION && tileEntity.getState() == DoorState.OPENED) return null;
    MultiBlock mb = ((ForcefieldTileEntity) tileEntity).getMultiBlock();
    if (mb == null) return null;

    float f = 0.5F /*- Door.DOOR_WIDTH / 2*/;
    AxisAlignedBB aabb = mb.getWorldBounds();
    if (aabb.minY == aabb.maxY - 1) {
      aabb.minY += f;
      aabb.maxY -= f;
    } else if (aabb.minX == aabb.maxX - 1) {
      aabb.minX += f;
      aabb.maxX -= f;
    } else if (aabb.minZ == aabb.maxZ - 1) {
      aabb.minZ += f;
      aabb.maxZ -= f;
    }

    return aabb;
  }
Пример #4
0
 @Override
 public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
   MultiBlock.destroy(world, x, y, z);
   world.setBlockToAir(x, y, z);
   return true;
 }