Example #1
0
 @Override
 public void onBlockPlacedBy(
     World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack itemStack) {
   byte chestFacing = 0;
   int facing =
       MathHelper.floor_double((double) ((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
   if (facing == 0) {
     chestFacing = 2;
   }
   if (facing == 1) {
     chestFacing = 5;
   }
   if (facing == 2) {
     chestFacing = 3;
   }
   if (facing == 3) {
     chestFacing = 4;
   }
   TileEntity te = world.getTileEntity(i, j, k);
   if (te != null && te instanceof SimObjectTileEntity) {
     SimObjectTileEntity teic = (SimObjectTileEntity) te;
     teic.setDirection(chestFacing);
     world.markBlockForUpdate(i, j, k);
   }
 }
Example #2
0
 @Override
 public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis) {
   if (worldObj.isRemote) {
     return false;
   }
   if (axis == UP || axis == DOWN) {
     TileEntity tileEntity = worldObj.getTileEntity(x, y, z);
     if (tileEntity instanceof SimObjectTileEntity) {
       SimObjectTileEntity icte = (SimObjectTileEntity) tileEntity;
       icte.rotateAround(axis);
     }
     return true;
   }
   return false;
 }