Java Code Examples for net.minecraft.nbt.compoundnbt#putString()
The following examples show how to use
net.minecraft.nbt.compoundnbt#putString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CmdEnchant.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") public void enchant(ItemStack item, Enchantment e, int level) { if (item.getTag() == null) item.setTag(new CompoundNBT()); if (!item.getTag().contains("Enchantments", 9)) { item.getTag().put("Enchantments", new ListNBT()); } ListNBT listnbt = item.getTag().getList("Enchantments", 10); CompoundNBT compoundnbt = new CompoundNBT(); compoundnbt.putString("id", String.valueOf(Registry.ENCHANTMENT.getKey(e))); compoundnbt.putInt("lvl", level); listnbt.add(compoundnbt); }
Example 2
Source File: UpgradeTools.java From MiningGadgets with MIT License | 5 votes |
/** * DO NOT USE UNLESS YOU KNOW WHAT YOU'RE DOING. This method does not, and for some reason * can not, validate the upgrade you are inserting to the item. Please be sure to always * use {@link MiningGadget#applyUpgrade(ItemStack, UpgradeCard)} unless you actually require this * kind of unchecked functionality */ private static void setUpgradeNBT(CompoundNBT nbt, UpgradeCard upgrade) { ListNBT list = nbt.getList(KEY_UPGRADES, Constants.NBT.TAG_COMPOUND); CompoundNBT compound = new CompoundNBT(); compound.putString(KEY_UPGRADE, upgrade.getUpgrade().getName()); compound.putBoolean(KEY_ENABLED, upgrade.getUpgrade().isEnabled()); list.add(compound); nbt.put(KEY_UPGRADES, list); }
Example 3
Source File: Frequency.java From EnderStorage with MIT License | 5 votes |
protected CompoundNBT write_internal(CompoundNBT tagCompound) { tagCompound.putInt("left", left.getWoolMeta()); tagCompound.putInt("middle", middle.getWoolMeta()); tagCompound.putInt("right", right.getWoolMeta()); if (owner != null) { tagCompound.putUniqueId("owner", owner); } if (ownerName != null) { tagCompound.putString("owner_name", ITextComponent.Serializer.toJson(ownerName)); } return tagCompound; }