Search in sources :

Example 16 with NBTTagString

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.");
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) NBTTagString(net.minecraft.nbt.NBTTagString) ItemStack(net.minecraft.item.ItemStack)

Example 17 with NBTTagString

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));
}
Also used : NBTTagString(net.minecraft.nbt.NBTTagString) NBTTagString(net.minecraft.nbt.NBTTagString) ItemStack(net.minecraft.item.ItemStack)

Example 18 with NBTTagString

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);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagString(net.minecraft.nbt.NBTTagString) NBTTagString(net.minecraft.nbt.NBTTagString)

Example 19 with NBTTagString

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");
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagString(net.minecraft.nbt.NBTTagString)

Example 20 with NBTTagString

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);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagString(net.minecraft.nbt.NBTTagString) UUID(java.util.UUID)

Aggregations

NBTTagString (net.minecraft.nbt.NBTTagString)98 NBTTagList (net.minecraft.nbt.NBTTagList)79 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)57 ItemStack (net.minecraft.item.ItemStack)16 NBTTagIntArray (net.minecraft.nbt.NBTTagIntArray)11 NBTTagByteArray (net.minecraft.nbt.NBTTagByteArray)10 NBTTagInt (net.minecraft.nbt.NBTTagInt)10 NBTBase (net.minecraft.nbt.NBTBase)9 NBTTagDouble (net.minecraft.nbt.NBTTagDouble)9 NBTTagFloat (net.minecraft.nbt.NBTTagFloat)9 NBTTagByte (net.minecraft.nbt.NBTTagByte)8 NBTTagLong (net.minecraft.nbt.NBTTagLong)8 ResourceLocation (net.minecraft.util.ResourceLocation)8 NBTTagShort (net.minecraft.nbt.NBTTagShort)7 List (java.util.List)6 Map (java.util.Map)5 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Item (net.minecraft.item.Item)4