Esempio n. 1
0
  public static boolean isOwnable(Class<? extends TileEntity> clazz) {
    for (SegmentTileEntity segment : segmentsTile.get(clazz)) {
      if (segment.retainsOwner()) {
        return true;
      }
    }

    return false;
  }
Esempio n. 2
0
    private SegmentTileEntity deserializeTileEntity(
        JsonObject json, JsonDeserializationContext context) {
      SegmentTileEntity segment = new SegmentTileEntity();

      segment.retainsOwner = json.getAsJsonObject().get("retainsOwner").getAsBoolean();
      json.remove("retainsOwner");

      return segment;
    }
Esempio n. 3
0
 public static void check(TileEntity te) {
   for (SegmentTileEntity segment : segmentsTile.get(te.getClass())) {
     if (!segment.shouldExist(te)) {
       ItemStack itemStack = new ItemStack(te.getBlockType(), 1, te.getBlockMetadata());
       NBTTagCompound nbt = new NBTTagCompound();
       te.writeToNBT(nbt);
       itemStack.setTagCompound(nbt);
       WorldUtils.dropAsEntity(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, itemStack);
       te.getWorldObj().setBlock(te.xCoord, te.yCoord, te.zCoord, Blocks.air);
       te.invalidate();
       MyTown.instance.LOG.info("TileEntity {} was ATOMICALLY DISINTEGRATED!", te.toString());
       return;
     }
   }
 }