コード例 #1
0
 ClayLump extrudeLump(ClayLump against, EnumFacing dir) {
   ClayLump lump = against.copy();
   Block b = FzUtil.getTraceHelper();
   against.toBlockBounds(b);
   int wX = lump.maxX - lump.minX;
   int wY = lump.maxY - lump.minY;
   int wZ = lump.maxZ - lump.minZ;
   lump.maxX += wX * dir.getDirectionVec().getX();
   lump.maxY += wY * dir.getDirectionVec().getY();
   lump.maxZ += wZ * dir.getDirectionVec().getZ();
   lump.minX += wX * dir.getDirectionVec().getX();
   lump.minY += wY * dir.getDirectionVec().getY();
   lump.minZ += wZ * dir.getDirectionVec().getZ();
   return lump;
 }
コード例 #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
 public ItemStack getItem() {
   ItemStack ret = Core.registry.greenware_item.copy();
   NBTTagCompound tag = new NBTTagCompound();
   byte r = rotation;
   setRotation((byte) 0);
   try {
     putData(new DataOutNBT(tag));
   } catch (IOException e) {
     e.printStackTrace();
   }
   setRotation(r);
   tag.setByte("front", (byte) front.ordinal());
   ret.setTagCompound(tag);
   if (customName != null) {
     ret.setStackDisplayName(customName);
   }
   return ret;
 }