コード例 #1
0
 @Override
 protected void onRemove() {
   super.onRemove();
   for (int x = -1; x <= 1; x++) {
     for (int y = -1; y <= 1; y++) {
       for (int z = -1; z <= 1; z++) {
         Coord c = getCoord().add(pos);
         TileEntityExtension tex = c.getTE(TileEntityExtension.class);
         if (tex != null && tex.getParent() == this) {
           c.setAir();
         }
       }
     }
   }
 }
コード例 #2
0
 @Override
 public void onPlacedBy(
     EntityPlayer player, ItemStack is, EnumFacing side, float hitX, float hitY, float hitZ) {
   super.onPlacedBy(player, is, side, hitX, hitY, hitZ);
   NBTTagCompound tag = null;
   if (is.hasTagCompound()) {
     tag = is.getTagCompound();
     try {
       putData(new DataInNBT(tag));
     } catch (IOException e) {
       e.printStackTrace();
     }
   } else {
     addLump();
   }
   EnumFacing placement = SpaceUtil.determineFlatOrientation(player);
   if (tag == null || !tag.hasKey("front")) {
     front = placement;
     setRotation((byte) 0);
   } else if (placement.getDirectionVec().getY() == 0 && placement != null) {
     front = SpaceUtil.getOrientation(tag.getByte("front"));
     if (front == null || front.getDirectionVec().getY() != 0) {
       setRotation((byte) 0);
       front = placement;
     } else {
       EnumFacing f = placement;
       byte r = 0;
       for (byte i = 0; i < 4; i++) {
         if (f == front) {
           r = i;
           break;
         }
         f = SpaceUtil.rotate(f, EnumFacing.UP);
       }
       setRotation(r);
     }
   }
 }
コード例 #3
0
 @Override
 public void setBlockBounds(Block b) {
   super.setBlockBounds(b);
   // b.setBlockBounds(-1, -1, -1, 1, 1, 1);
 }