Examples of NBTTagList


Examples of net.minecraft.nbt.NBTTagList

  }

  @Override
  public void transformToBlueprint(MappingRegistry registry,
      Translation transform) {
    NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
    Position pos = new Position(nbttaglist.func_150309_d(0),
        nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
    pos = transform.translate(pos);

    cpt.setTag("Pos",
        this.newDoubleNBTList(pos.x, pos.y, pos.z));
View Full Code Here

Examples of net.minecraft.nbt.NBTTagList

    inventorySlotsToBlueprint(registry, cpt);
  }

  @Override
  public void transformToWorld(MappingRegistry registry, Translation transform) {
    NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
    Position pos = new Position(nbttaglist.func_150309_d(0),
        nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
    pos = transform.translate(pos);

    cpt.setTag("Pos",
        this.newDoubleNBTList(pos.x, pos.y, pos.z));
View Full Code Here

Examples of net.minecraft.nbt.NBTTagList

    inventorySlotsToWorld(registry, cpt);
  }

  @Override
  public void rotateLeft(IBuilderContext context) {
    NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
    Position pos = new Position(nbttaglist.func_150309_d(0),
        nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
    pos = context.rotatePositionLeft(pos);
    cpt.setTag("Pos",
        this.newDoubleNBTList(pos.x, pos.y, pos.z));

    nbttaglist = cpt.getTagList("Rotation", 5);
    float yaw = nbttaglist.func_150308_e(0);
    yaw += 90;
    cpt.setTag(
        "Rotation",
        this.newFloatNBTList(yaw,
            nbttaglist.func_150308_e(1)));
  }
View Full Code Here

Examples of net.minecraft.nbt.NBTTagList

            nbttaglist.func_150308_e(1)));
  }

  @Override
  public void writeToNBT(NBTTagCompound nbt, MappingRegistry registry) {
    NBTTagList nbttaglist = cpt.getTagList("Pos", 6);

    nbt.setInteger("entityId", registry.getIdForEntity(entity));
    nbt.setTag("entity", cpt);

    NBTTagList rq = new NBTTagList();

    for (ItemStack stack : storedRequirements) {
      NBTTagCompound sub = new NBTTagCompound();
      stack.writeToNBT(stack.writeToNBT(sub));
      sub.setInteger("id", registry.getIdForItem(stack.getItem()));
      rq.appendTag(sub);
    }

    nbt.setTag("rq", rq);
  }
View Full Code Here

Examples of net.minecraft.nbt.NBTTagList

  @Override
  public void readFromNBT(NBTTagCompound nbt, MappingRegistry registry) {
    cpt = nbt.getCompoundTag("entity");

    NBTTagList rq = nbt.getTagList("rq",
        Constants.NBT.TAG_COMPOUND);

    ArrayList<ItemStack> rqs = new ArrayList<ItemStack>();

    for (int i = 0; i < rq.tagCount(); ++i) {
      try {
        NBTTagCompound sub = rq.getCompoundTagAt(i);

        if (sub.getInteger("id") >= 0) {
          // Maps the id in the blueprint to the id in the world
          sub.setInteger("id", Item.itemRegistry
              .getIDForObject(registry.getItemForId(sub
View Full Code Here

Examples of net.minecraft.nbt.NBTTagList

    storedRequirements = rqs.toArray(new ItemStack[rqs.size()]);
  }

  protected NBTTagList newDoubleNBTList(double... par1ArrayOfDouble) {
    NBTTagList nbttaglist = new NBTTagList();
    double[] adouble = par1ArrayOfDouble;
    int i = par1ArrayOfDouble.length;

    for (int j = 0; j < i; ++j) {
      double d1 = adouble[j];
      nbttaglist.appendTag(new NBTTagDouble(d1));
    }

    return nbttaglist;
  }
View Full Code Here

Examples of net.minecraft.nbt.NBTTagList

    return nbttaglist;
  }

  protected NBTTagList newFloatNBTList(float... par1ArrayOfFloat) {
    NBTTagList nbttaglist = new NBTTagList();
    float[] afloat = par1ArrayOfFloat;
    int i = par1ArrayOfFloat.length;

    for (int j = 0; j < i; ++j) {
      float f1 = afloat[j];
      nbttaglist.appendTag(new NBTTagFloat(f1));
    }

    return nbttaglist;
  }
View Full Code Here

Examples of net.minecraft.nbt.NBTTagList

    return nbttaglist;
  }

  public boolean isAlreadyBuilt(IBuilderContext context) {
    NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
    Position newPosition = new Position(nbttaglist.func_150309_d(0),
        nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));

    for (Object o : context.world().loadedEntityList) {
      Entity e = (Entity) o;

      Position existingPositon = new Position(e.posX, e.posY, e.posZ);
View Full Code Here

Examples of net.minecraft.nbt.NBTTagList

    return entityToId.get(entity);
  }

  public void write (NBTTagCompound nbt) {
    NBTTagList blocksMapping = new NBTTagList();

    for (Block b : idToBlock) {
      NBTTagCompound sub = new NBTTagCompound();
      sub.setString("name",
          Block.blockRegistry.getNameForObject(b));
      blocksMapping.appendTag(sub);
    }

    nbt.setTag("blocksMapping", blocksMapping);

    NBTTagList itemsMapping = new NBTTagList();

    for (Item i : idToItem) {
      NBTTagCompound sub = new NBTTagCompound();
      sub.setString("name",
          Item.itemRegistry.getNameForObject(i));
      itemsMapping.appendTag(sub);
    }

    nbt.setTag("itemsMapping", itemsMapping);

    NBTTagList entitiesMapping = new NBTTagList();

    for (Class<? extends Entity> e : idToEntity) {
      NBTTagCompound sub = new NBTTagCompound();
      sub.setString("name", e.getCanonicalName());
      entitiesMapping.appendTag(sub);
    }

    nbt.setTag("entitiesMapping", entitiesMapping);
  }
View Full Code Here

Examples of net.minecraft.nbt.NBTTagList

    nbt.setTag("entitiesMapping", entitiesMapping);
  }

  public void read (NBTTagCompound nbt) {
    NBTTagList blocksMapping = nbt.getTagList("blocksMapping",
        Constants.NBT.TAG_COMPOUND);

    for (int i = 0; i < blocksMapping.tagCount(); ++i) {
      NBTTagCompound sub = blocksMapping.getCompoundTagAt(i);
      String name = sub.getString("name");
      Block b = (Block) Block.blockRegistry.getObject(name);
      registerBlock (b);
    }

    NBTTagList itemsMapping = nbt.getTagList("itemsMapping",
        Constants.NBT.TAG_COMPOUND);

    for (int i = 0; i < itemsMapping.tagCount(); ++i) {
      NBTTagCompound sub = itemsMapping.getCompoundTagAt(i);
      String name = sub.getString("name");
      Item item = (Item) Item.itemRegistry.getObject(name);
      registerItem (item);
    }

    NBTTagList entitiesMapping = nbt.getTagList("entitiesMapping",
        Constants.NBT.TAG_COMPOUND);

    for (int i = 0; i < entitiesMapping.tagCount(); ++i) {
      NBTTagCompound sub = entitiesMapping.getCompoundTagAt(i);
      String name = sub.getString("name");
      Class<? extends Entity> e = null;

      try {
        e = (Class<? extends Entity>) Class.forName(name);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.