public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); nbttagcompound.a("Text1", this.e[0]); nbttagcompound.a("Text2", this.e[1]); nbttagcompound.a("Text3", this.e[2]); nbttagcompound.a("Text4", this.e[3]); }
public Tile(Map map, Tile tile, int x, int y) { this.map = map; this.x = x; this.y = y; this.height = tile.height; this.ground = tile.ground; this.cave = tile.cave; this.label = tile.label; HashMap<EntityData, TileEntity> entities = new HashMap<>(); for (Entry<EntityData, TileEntity> entrySet : tile.entities.entrySet()) { EntityData key = entrySet.getKey(); TileEntity value = entrySet.getValue(); entities.put(key, value.deepCopy()); } this.entities = new HashMap(tile.entities); }
public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); for (int i = 0; i < 4; ++i) { this.e[i] = nbttagcompound.h("Text" + (i + 1)); if (this.e[i].length() > 15) { this.e[i] = this.e[i].substring(0, 15); } } }
public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); this.note = nbttagcompound.getByte("note"); if (this.note < 0) { this.note = 0; } if (this.note > 24) { this.note = 24; } }
/** * Tests the given object to see if it equals this object * * @param obj the object to test * @return true if the two objects match */ @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof TileEntity)) { return false; } final TileEntity other = (TileEntity) obj; if (getX() != other.getX()) { return false; } if (getY() != other.getY()) { return false; } if (getZ() != other.getZ()) { return false; } return true; }
public static boolean a( World world, EntityHuman entityhuman, BlockPosition blockposition, ItemStack itemstack) { MinecraftServer minecraftserver = MinecraftServer.getServer(); if (minecraftserver == null) { return false; } else { if (itemstack.hasTag() && itemstack.getTag().hasKeyOfType("BlockEntityTag", 10)) { TileEntity tileentity = world.getTileEntity(blockposition); if (tileentity != null) { if (!world.isClientSide && tileentity.F() && !minecraftserver.getPlayerList().isOp(entityhuman.getProfile())) { return false; } NBTTagCompound nbttagcompound = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.clone(); tileentity.b(nbttagcompound); NBTTagCompound nbttagcompound2 = (NBTTagCompound) itemstack.getTag().get("BlockEntityTag"); nbttagcompound.a(nbttagcompound2); nbttagcompound.setInt("x", blockposition.getX()); nbttagcompound.setInt("y", blockposition.getY()); nbttagcompound.setInt("z", blockposition.getZ()); if (!nbttagcompound.equals(nbttagcompound1)) { tileentity.a(nbttagcompound); tileentity.update(); return true; } } } return false; } }
public void readFromNBT(NBTTagCompound nbttagcompound) { super.readFromNBT(nbttagcompound); // timeleft = nbttagcompound.getInteger("timeleft"); NBTTagList nbttaglist = nbttagcompound.getTagList("Items"); metalItemStacks = new ItemStack[getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); i++) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i); byte byte0 = nbttagcompound1.getByte("Slot"); if (byte0 >= 0 && byte0 < metalItemStacks.length) { metalItemStacks[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } }
public void writeToNBT(NBTTagCompound nbttagcompound) { super.writeToNBT(nbttagcompound); // nbttagcompound.setInteger("timeleft", timeleft); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < metalItemStacks.length; i++) { if (metalItemStacks[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte) i); metalItemStacks[i].writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } nbttagcompound.setTag("Items", nbttaglist); }
public void writeToNBT(NBTTagCompound nbttagcompound) { super.writeToNBT(nbttagcompound); nbttagcompound.setShort("BurnTime", (short) furnaceBurnTime); nbttagcompound.setShort("CookTime", (short) furnaceCookTime); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < furnaceItemStacks.length; i++) { if (furnaceItemStacks[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte) i); furnaceItemStacks[i].writeToNBT(nbttagcompound1); nbttaglist.setTag(nbttagcompound1); } } nbttagcompound.setTag("Items", nbttaglist); }
public void readFromNBT(NBTTagCompound nbttagcompound) { super.readFromNBT(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.getTagList("Items"); furnaceItemStacks = new ItemStack[getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); i++) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i); byte byte0 = nbttagcompound1.getByte("Slot"); if (byte0 >= 0 && byte0 < furnaceItemStacks.length) { furnaceItemStacks[byte0] = new ItemStack(nbttagcompound1); } } furnaceBurnTime = nbttagcompound.getShort("BurnTime"); furnaceCookTime = nbttagcompound.getShort("CookTime"); currentItemBurnTime = getItemBurnTime(furnaceItemStacks[1]); }
/** Writes a tile entity to NBT. */ public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setShort("BurnTime", (short) this.combinerBurnTime); par1NBTTagCompound.setShort("CookTime", (short) this.combinerCookTime); NBTTagList var2 = new NBTTagList(); for (int var3 = 0; var3 < this.combinerItemStacks.length; ++var3) { if (this.combinerItemStacks[var3] != null) { NBTTagCompound var4 = new NBTTagCompound(); var4.setByte("Slot", (byte) var3); this.combinerItemStacks[var3].writeToNBT(var4); var2.appendTag(var4); } } par1NBTTagCompound.setTag("Items", var2); }
/** Reads a tile entity from NBT. */ public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); this.combinerItemStacks = new ItemStack[this.getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) { NBTTagCompound var4 = (NBTTagCompound) var2.tagAt(var3); byte var5 = var4.getByte("Slot"); if (var5 >= 0 && var5 < this.combinerItemStacks.length) { this.combinerItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4); } } this.combinerBurnTime = par1NBTTagCompound.getShort("BurnTime"); this.combinerCookTime = par1NBTTagCompound.getShort("CookTime"); this.currentItemBurnTime = getItemBurnTime(this.combinerItemStacks[1]); }
public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); nbttagcompound.a("BurnTime", (short) e); nbttagcompound.a("CookTime", (short) g); NBTTagList nbttaglist = new NBTTagList(); for (int j = 0; j < h.length; j++) { if (h[j] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.a("Slot", (byte) j); h[j].a(nbttagcompound1); nbttaglist.a(((NBTBase) (nbttagcompound1))); } } nbttagcompound.a("Items", ((NBTBase) (nbttaglist))); }
public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.k("Items"); h = new ItemStack[h_()]; for (int j = 0; j < nbttaglist.b(); j++) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(j); byte byte0 = nbttagcompound1.b("Slot"); if (byte0 >= 0 && byte0 < h.length) { h[byte0] = new ItemStack(nbttagcompound1); } } e = ((int) (nbttagcompound.c("BurnTime"))); g = ((int) (nbttagcompound.c("CookTime"))); f = a(h[1]); }
public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); nbttagcompound.setShort("BurnTime", (short) this.burnTime); nbttagcompound.setShort("CookTime", (short) this.cookTime); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.items.length; ++i) { if (this.items[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte) i); this.items[i].save(nbttagcompound1); nbttaglist.add(nbttagcompound1); } } nbttagcompound.set("Items", nbttaglist); if (this.k_()) { nbttagcompound.setString("CustomName", this.o); } }
public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.getList("Items", 10); this.items = new ItemStack[this.getSize()]; for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.get(i); byte b0 = nbttagcompound1.getByte("Slot"); if (b0 >= 0 && b0 < this.items.length) { this.items[b0] = ItemStack.createStack(nbttagcompound1); } } this.burnTime = nbttagcompound.getShort("BurnTime"); this.cookTime = nbttagcompound.getShort("CookTime"); this.ticksForCurrentFuel = fuelTime(this.items[1]); if (nbttagcompound.hasKeyOfType("CustomName", 8)) { this.o = nbttagcompound.getString("CustomName"); } }
public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); this.a.a(nbttagcompound); }
public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); nbttagcompound.setByte("note", this.note); }
private void renderEntities(GL2 g) { for (Entry<EntityData, TileEntity> e : entities.entrySet()) { EntityData key = e.getKey(); final int floor = key.getFloor(); float colorMod = 1; if (Globals.upCamera) { switch (Globals.floor - floor) { case 0: colorMod = 1; break; case 1: colorMod = 0.6f; break; case 2: colorMod = 0.25f; break; default: continue; } } TileEntity entity = e.getValue(); g.glPushMatrix(); switch (key.getType()) { case FLOORROOF: g.glTranslatef(4, 0, 3 * floor + getFloorHeight() / Constants.HEIGHT_MOD); g.glColor3f(colorMod, colorMod, colorMod); entity.render(g, this); break; case VWALL: case VFENCE: g.glTranslatef(0, 0, 3 * floor + getVerticalWallHeight() / Constants.HEIGHT_MOD); g.glRotatef(90, 0, 0, 1); float vdiff = getVerticalWallHeightDiff() / 47f; if (vdiff < 0) { g.glTranslatef(0, 0, -vdiff * 4f); } deform(g, vdiff); Wall vwall = (Wall) entity; if (Globals.upCamera) { vwall.data.color.use(g, colorMod); } else { g.glColor3f(1, 1, 1); } vwall.render(g, this); g.glColor3f(1, 1, 1); break; case HWALL: case HFENCE: g.glTranslatef(0, 0, 3 * floor + getHorizontalWallHeight() / Constants.HEIGHT_MOD); float hdiff = getHorizontalWallHeightDiff() / 47f; if (hdiff < 0) { g.glTranslatef(0, 0, -hdiff * 4f); } deform(g, hdiff); Wall hwall = (Wall) entity; if (Globals.upCamera) { hwall.data.color.use(g, colorMod); } else { g.glColor3f(1, 1, 1); } hwall.render(g, this); g.glColor3f(1, 1, 1); break; case OBJECT: ObjectEntityData objData = (ObjectEntityData) key; ObjectLocation loc = objData.getLocation(); GameObject obj = (GameObject) entity; g.glColor3f(colorMod, colorMod, colorMod); g.glTranslatef( loc.getHorizontalAlign(), loc.getVerticalAlign(), 3 * floor + getHeight(loc.getHorizontalAlign() / 4f, loc.getVerticalAlign() / 4f) / Constants.HEIGHT_MOD); obj.render(g, this); break; } g.glPopMatrix(); g.glColor3f(1, 1, 1); } }
public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); this.a.b(nbttagcompound); }
public void serialize(Document doc, Element root) { Element tile = doc.createElement("tile"); tile.setAttribute("x", Integer.toString(x)); tile.setAttribute("y", Integer.toString(y)); tile.setAttribute("height", Float.toString(height)); tile.setAttribute("caveHeight", Float.toString(caveHeight)); tile.setAttribute("caveSize", Float.toString(caveSize)); root.appendChild(tile); ground.serialize(doc, tile); cave.serialize(doc, tile); if (label != null) { label.serialize(doc, tile, false); } if (caveLabel != null) { caveLabel.serialize(doc, tile, true); } final HashMap<Integer, Element> levels = new HashMap<>(); for (Entry<EntityData, TileEntity> e : entities.entrySet()) { final EntityData key = e.getKey(); final TileEntity entity = e.getValue(); final int floor = key.getFloor(); Element level = levels.get(floor); if (level == null) { level = doc.createElement("level"); level.setAttribute("value", Integer.toString(key.getFloor())); levels.put(key.getFloor(), level); tile.appendChild(level); } switch (key.getType()) { case FLOORROOF: entity.serialize(doc, level); break; case HWALL: case HFENCE: Element hWall = doc.createElement("hWall"); entity.serialize(doc, hWall); level.appendChild(hWall); break; case VWALL: case VFENCE: Element vWall = doc.createElement("vWall"); entity.serialize(doc, vWall); level.appendChild(vWall); break; case HBORDER: Element hDeco = doc.createElement("hBorder"); entity.serialize(doc, hDeco); level.appendChild(hDeco); break; case VBORDER: Element vDeco = doc.createElement("vBorder"); entity.serialize(doc, vDeco); level.appendChild(vDeco); break; case OBJECT: ObjectEntityData objectData = (ObjectEntityData) key; Element objectElement = doc.createElement("object"); objectElement.setAttribute("position", objectData.getLocation().toString()); entity.serialize(doc, objectElement); level.appendChild(objectElement); break; } } }
public void a(MobSpawnerAbstract.a mobspawnerabstract_a) { super.a(mobspawnerabstract_a); if (this.a() != null) { this.a().notify(TileEntityMobSpawner.this.position); } }