use of net.minecraft.nbt.NBTTagString in project Wurst-MC-1.12 by Wurst-Imperium.
the class CmdBlockMod method createCmdBlock.
public void createCmdBlock(String cmd) {
// generate cmd-block
ItemStack stack = new ItemStack(Blocks.COMMAND_BLOCK);
NBTTagCompound nbtTagCompound = new NBTTagCompound();
nbtTagCompound.setTag("Command", new NBTTagString(cmd));
stack.writeToNBT(nbtTagCompound);
stack.setTagInfo("BlockEntityTag", nbtTagCompound);
// give cmd-block
if (InventoryUtils.placeStackInHotbar(stack))
ChatUtils.message("Command Block created.");
else
ChatUtils.error("Please clear a slot in your hotbar.");
}
use of net.minecraft.nbt.NBTTagString in project Wurst-MC-1.12 by Wurst-Imperium.
the class AuthorCmd method call.
@Override
public void call(String[] args) throws CmdException {
if (args.length == 0)
throw new CmdSyntaxError();
if (!WMinecraft.getPlayer().capabilities.isCreativeMode)
throw new CmdError("Creative mode only.");
ItemStack item = WMinecraft.getPlayer().inventory.getCurrentItem();
if (item == null || Item.getIdFromItem(item.getItem()) != 387)
throw new CmdError("You are not holding a written book in your hand.");
String author = args[0];
for (int i = 1; i < args.length; i++) author += " " + args[i];
item.setTagInfo("author", new NBTTagString(author));
}
use of net.minecraft.nbt.NBTTagString in project RFToolsControl by McJty.
the class ProcessorTileEntity method writeLocks.
private void writeLocks(NBTTagCompound tagCompound) {
NBTTagList lockList = new NBTTagList();
for (String name : locks) {
lockList.appendTag(new NBTTagString(name));
}
tagCompound.setTag("locks", lockList);
}
use of net.minecraft.nbt.NBTTagString in project Random-Things by lumien231.
the class SpectreCube method readFromNBT.
public void readFromNBT(NBTTagCompound compound) {
this.owner = UUID.fromString(compound.getString("owner"));
this.position = compound.getInteger("position");
NBTTagList guestTagList = compound.getTagList("guestTagList", (byte) 8);
for (int i = 0; i < guestTagList.tagCount(); i++) {
NBTTagString uuidString = (NBTTagString) guestTagList.get(i);
this.guests.add(UUID.fromString(uuidString.getString()));
}
this.height = compound.getInteger("height");
this.spawnBlock = NBTUtil.readBlockPosFromNBT(compound, "spawnBlock");
}
use of net.minecraft.nbt.NBTTagString in project Random-Things by lumien231.
the class SpectreCube method writeToNBT.
public void writeToNBT(NBTTagCompound compound) {
compound.setString("owner", owner.toString());
compound.setInteger("position", position);
NBTTagList guestTagList = new NBTTagList();
for (UUID uuid : guests) {
guestTagList.appendTag(new NBTTagString(uuid.toString()));
}
compound.setTag("guests", guestTagList);
compound.setInteger("height", height);
NBTUtil.writeBlockPosToNBT(compound, "spawnBlock", spawnBlock);
}
Aggregations