コード例 #1
0
  @Override
  public boolean rotateBlock(World world, int x, int y, int z, ForgeDirection axis) {
    if (Arrays.asList(getRotationAxes()).contains(axis)) {
      TEBase TE = getTileEntity(world, x, y, z);
      if (TE != null && data.isFreestanding(TE)) {
        int side = data.getDirection(TE).ordinal() == data.DIR_ON_X ? data.DIR_ON_Z : data.DIR_ON_X;
        return data.setDirection(TE, ForgeDirection.getOrientation(side));
      }
    }

    return super.rotateBlock(world, x, y, z, axis);
  }
コード例 #2
0
 @Override
 /**
  * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed
  * (coordinates passed are their own) Args: x, y, z, neighbor blockID
  */
 public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
   if (!world.isRemote) {
     TEBase TE = getTileEntity(world, x, y, z);
     if (TE != null && !data.isFreestanding(TE)) {
       super.onNeighborBlockChange(world, x, y, z, block);
     }
   }
 }