public NBTTagCompound toNBT() { NBTTagCompound tag = new NBTTagCompound(); tag.setString("ModId", modId); tag.setString("ItemType", itemType); tag.setInt("ItemId", itemId); tag.setInt("ordinal", ordinal); return tag; }
protected ChatHoverable aP() { NBTTagCompound nbttagcompound = new NBTTagCompound(); String s = EntityTypes.b(this); nbttagcompound.setString("id", this.getUniqueID().toString()); if (s != null) { nbttagcompound.setString("type", s); } nbttagcompound.setString("name", this.getName()); return new ChatHoverable( EnumHoverAction.SHOW_ENTITY, new ChatComponentText(nbttagcompound.toString())); }
protected void b(NBTTagCompound var1) { if (this.x()) { var1.setBoolean("CustomDisplayTile", true); IBlockData var2 = this.getDisplayBlock(); MinecraftKey var3 = (MinecraftKey) Block.REGISTRY.c(var2.getBlock()); var1.setString("DisplayTile", var3 == null ? "" : var3.toString()); var1.setInt("DisplayData", var2.getBlock().toLegacyData(var2)); var1.setInt("DisplayOffset", this.getDisplayBlockOffset()); } if (this.b != null && this.b.length() > 0) { var1.setString("CustomName", this.b); } }
public void d(NBTTagCompound nbttagcompound) { nbttagcompound.a( "Pos", (NBTBase) this.a(new double[] {this.locX, this.locY + (double) this.br, this.locZ})); nbttagcompound.a("Motion", (NBTBase) this.a(new double[] {this.motX, this.motY, this.motZ})); // CraftBukkit start - checking for NaN pitch/yaw and resetting to zero // TODO: make sure this is the best way to address this. if (Float.isNaN(this.yaw)) { this.yaw = 0; } if (Float.isNaN(this.pitch)) { this.pitch = 0; } // CraftBukkit end nbttagcompound.a("Rotation", (NBTBase) this.a(new float[] {this.yaw, this.pitch})); nbttagcompound.a("FallDistance", this.fallDistance); nbttagcompound.a("Fire", (short) this.fireTicks); nbttagcompound.a("Air", (short) this.airTicks); nbttagcompound.a("OnGround", this.onGround); // CraftBukkit start nbttagcompound.setString("World", world.worldData.name); nbttagcompound.a("UUIDLeast", this.uniqueId.getLeastSignificantBits()); nbttagcompound.a("UUIDMost", this.uniqueId.getMostSignificantBits()); // CraftBukkit end this.b(nbttagcompound); }
@Override void applyToItem(NBTTagCompound itemData) { super.applyToItem(itemData); if (hasTitle()) { itemData.setString(BOOK_TITLE.NBT, this.title); } if (hasAuthor()) { itemData.setString(BOOK_AUTHOR.NBT, this.author); } if (hasPages()) { itemData.set(BOOK_PAGES.NBT, createStringList(pages, BOOK_PAGES)); } }
/** Called when saving data. If overriding, remember to call this version */ public void writeToNBT(NBTTagCompound root) { root.setString("World", mLocation.getWorld().getName()); root.setDouble("X", mLocation.getX()); root.setDouble("Y", mLocation.getY()); root.setDouble("Z", mLocation.getZ()); Util.writeItemStackToNBT(mHoverItemTemplate, root); }
public boolean c(NBTTagCompound nbttagcompound) { String s = this.af(); if (!this.dead && s != null) { nbttagcompound.setString("id", s); this.d(nbttagcompound); return true; } else { return false; } }
public boolean d(NBTTagCompound nbttagcompound) { String s = this.ag(); if (!this.dead && s != null && this.passenger == null) { nbttagcompound.setString("id", s); this.e(nbttagcompound); return true; } else { return false; } }
public void b(NBTTagCompound nbttagcompound) { String s = (String) TileEntity.g.get(this.getClass()); if (s == null) { throw new RuntimeException(this.getClass() + " is missing a mapping! This is a bug!"); } else { nbttagcompound.setString("id", s); nbttagcompound.setInt("x", this.position.getX()); nbttagcompound.setInt("y", this.position.getY()); nbttagcompound.setInt("z", this.position.getZ()); } }
public void b(NBTTagCompound nbttagcompound) { String s = (String) j.get(this.getClass()); if (s == null) throw new RuntimeException(this.getClass() + " is missing a mapping! This is a bug!"); else { nbttagcompound.setString("id", s); nbttagcompound.setInt("x", x); nbttagcompound.setInt("y", y); nbttagcompound.setInt("z", z); } }
public NBTTagCompound a() { NBTTagCompound nbttagcompound = new NBTTagCompound("GameRules"); Iterator iterator = this.a.keySet().iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); GameRuleValue gamerulevalue = (GameRuleValue) this.a.get(s); nbttagcompound.setString(s, gamerulevalue.a()); } return nbttagcompound; }
public NBTTagCompound save(NBTTagCompound nbttagcompound) { MinecraftKey minecraftkey = (MinecraftKey) Item.REGISTRY.c(this.item); nbttagcompound.setString( "id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString()); nbttagcompound.setByte("Count", (byte) this.count); nbttagcompound.setShort("Damage", (short) this.damage); if (this.tag != null) { nbttagcompound.set( "tag", this.tag.clone()); // CraftBukkit - make defensive copy, data is going to another thread } return nbttagcompound; }
public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); 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.a); } }
public void e(NBTTagCompound nbttagcompound) { try { nbttagcompound.set("Pos", this.a(new double[] {this.locX, this.locY, this.locZ})); nbttagcompound.set("Motion", this.a(new double[] {this.motX, this.motY, this.motZ})); nbttagcompound.set("Rotation", this.a(new float[] {this.yaw, this.pitch})); nbttagcompound.setFloat("FallDistance", this.fallDistance); nbttagcompound.setShort("Fire", (short) this.fireTicks); nbttagcompound.setShort("Air", (short) this.getAirTicks()); nbttagcompound.setBoolean("OnGround", this.onGround); nbttagcompound.setInt("Dimension", this.dimension); nbttagcompound.setBoolean("Invulnerable", this.invulnerable); nbttagcompound.setInt("PortalCooldown", this.portalCooldown); nbttagcompound.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits()); nbttagcompound.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits()); if (this.getCustomName() != null && this.getCustomName().length() > 0) { nbttagcompound.setString("CustomName", this.getCustomName()); nbttagcompound.setBoolean("CustomNameVisible", this.getCustomNameVisible()); } this.as.b(nbttagcompound); if (this.R()) { nbttagcompound.setBoolean("Silent", this.R()); } this.b(nbttagcompound); if (this.vehicle != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); if (this.vehicle.c(nbttagcompound1)) { nbttagcompound.set("Riding", nbttagcompound1); } } } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being saved"); this.appendEntityCrashDetails(crashreportsystemdetails); throw new ReportedException(crashreport); } }
public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); nbttagcompound.setBoolean("EatingHaystack", this.cm()); nbttagcompound.setBoolean("ChestedHorse", this.hasChest()); nbttagcompound.setBoolean("HasReproduced", this.cp()); nbttagcompound.setBoolean("Bred", this.co()); nbttagcompound.setInt("Type", this.getType()); nbttagcompound.setInt("Variant", this.getVariant()); nbttagcompound.setInt("Temper", this.getTemper()); nbttagcompound.setBoolean("Tame", this.isTame()); nbttagcompound.setString("OwnerUUID", this.getOwnerUUID()); nbttagcompound.setInt("Bukkit.MaxDomestication", this.maxDomestication); // CraftBukkit if (this.hasChest()) { NBTTagList nbttaglist = new NBTTagList(); for (int i = 2; i < this.inventoryChest.getSize(); ++i) { ItemStack itemstack = this.inventoryChest.getItem(i); if (itemstack != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte) i); itemstack.save(nbttagcompound1); nbttaglist.add(nbttagcompound1); } } nbttagcompound.set("Items", nbttaglist); } if (this.inventoryChest.getItem(1) != null) { nbttagcompound.set("ArmorItem", this.inventoryChest.getItem(1).save(new NBTTagCompound())); } if (this.inventoryChest.getItem(0) != null) { nbttagcompound.set("SaddleItem", this.inventoryChest.getItem(0).save(new NBTTagCompound())); } }
@Override public boolean update(boolean force, boolean applyPhysics) { boolean result = (isPlaced()) ? super.update(force, applyPhysics) : true; if (result) { banner.color = base.getDyeData(); NBTTagList newPatterns = new NBTTagList(); for (Pattern p : patterns) { NBTTagCompound compound = new NBTTagCompound(); compound.setInt("Color", p.getColor().getDyeData()); compound.setString("Pattern", p.getPattern().getIdentifier()); newPatterns.add(compound); } banner.patterns = newPatterns; banner.update(); } return result; }
@Override public BlockState getBlockState() { if (blockEntityTag != null) { switch (material) { case SHIELD: blockEntityTag.setString("id", "banner"); break; case WHITE_SHULKER_BOX: case ORANGE_SHULKER_BOX: case MAGENTA_SHULKER_BOX: case LIGHT_BLUE_SHULKER_BOX: case YELLOW_SHULKER_BOX: case LIME_SHULKER_BOX: case PINK_SHULKER_BOX: case GRAY_SHULKER_BOX: case SILVER_SHULKER_BOX: case CYAN_SHULKER_BOX: case PURPLE_SHULKER_BOX: case BLUE_SHULKER_BOX: case BROWN_SHULKER_BOX: case GREEN_SHULKER_BOX: case RED_SHULKER_BOX: case BLACK_SHULKER_BOX: blockEntityTag.setString("id", "shulker_box"); break; } } TileEntity te = (blockEntityTag == null) ? null : TileEntity.a(null, blockEntityTag); switch (material) { case SIGN: case SIGN_POST: case WALL_SIGN: if (te == null) { te = new TileEntitySign(); } return new CraftSign(material, (TileEntitySign) te); case CHEST: case TRAPPED_CHEST: if (te == null) { te = new TileEntityChest(); } return new CraftChest(material, (TileEntityChest) te); case BURNING_FURNACE: case FURNACE: if (te == null) { te = new TileEntityFurnace(); } return new CraftFurnace(material, (TileEntityFurnace) te); case DISPENSER: if (te == null) { te = new TileEntityDispenser(); } return new CraftDispenser(material, (TileEntityDispenser) te); case DROPPER: if (te == null) { te = new TileEntityDropper(); } return new CraftDropper(material, (TileEntityDropper) te); case END_GATEWAY: if (te == null) { te = new TileEntityEndGateway(); } return new CraftEndGateway(material, (TileEntityEndGateway) te); case HOPPER: if (te == null) { te = new TileEntityHopper(); } return new CraftHopper(material, (TileEntityHopper) te); case MOB_SPAWNER: if (te == null) { te = new TileEntityMobSpawner(); } return new CraftCreatureSpawner(material, (TileEntityMobSpawner) te); case NOTE_BLOCK: if (te == null) { te = new TileEntityNote(); } return new CraftNoteBlock(material, (TileEntityNote) te); case JUKEBOX: if (te == null) { te = new BlockJukeBox.TileEntityRecordPlayer(); } return new CraftJukebox(material, (BlockJukeBox.TileEntityRecordPlayer) te); case BREWING_STAND_ITEM: if (te == null) { te = new TileEntityBrewingStand(); } return new CraftBrewingStand(material, (TileEntityBrewingStand) te); case SKULL: if (te == null) { te = new TileEntitySkull(); } return new CraftSkull(material, (TileEntitySkull) te); case COMMAND: case COMMAND_REPEATING: case COMMAND_CHAIN: if (te == null) { te = new TileEntityCommand(); } return new CraftCommandBlock(material, (TileEntityCommand) te); case BEACON: if (te == null) { te = new TileEntityBeacon(); } return new CraftBeacon(material, (TileEntityBeacon) te); case SHIELD: case BANNER: case WALL_BANNER: case STANDING_BANNER: if (te == null) { te = new TileEntityBanner(); } return new CraftBanner(material, (TileEntityBanner) te); case FLOWER_POT_ITEM: if (te == null) { te = new TileEntityFlowerPot(); } return new CraftFlowerPot(material, (TileEntityFlowerPot) te); case STRUCTURE_BLOCK: if (te == null) { te = new TileEntityStructure(); } return new CraftStructureBlock(material, (TileEntityStructure) te); case WHITE_SHULKER_BOX: case ORANGE_SHULKER_BOX: case MAGENTA_SHULKER_BOX: case LIGHT_BLUE_SHULKER_BOX: case YELLOW_SHULKER_BOX: case LIME_SHULKER_BOX: case PINK_SHULKER_BOX: case GRAY_SHULKER_BOX: case SILVER_SHULKER_BOX: case CYAN_SHULKER_BOX: case PURPLE_SHULKER_BOX: case BLUE_SHULKER_BOX: case BROWN_SHULKER_BOX: case GREEN_SHULKER_BOX: case RED_SHULKER_BOX: case BLACK_SHULKER_BOX: if (te == null) { te = new TileEntityShulkerBox(); } return new CraftShulkerBox(material, (TileEntityShulkerBox) te); case ENCHANTMENT_TABLE: if (te == null) { te = new TileEntityEnchantTable(); } return new CraftEnchantingTable(material, (TileEntityEnchantTable) te); case ENDER_CHEST: if (te == null) { te = new TileEntityEnderChest(); } return new CraftEnderChest(material, (TileEntityEnderChest) te); case DAYLIGHT_DETECTOR: case DAYLIGHT_DETECTOR_INVERTED: if (te == null) { te = new TileEntityLightDetector(); } return new CraftDaylightDetector(material, (TileEntityLightDetector) te); case REDSTONE_COMPARATOR: if (te == null) { te = new TileEntityComparator(); } return new CraftComparator(material, (TileEntityComparator) te); default: throw new IllegalStateException("Missing blockState for " + material); } }