Package net.minecraft.nbt

Examples of net.minecraft.nbt.NBTTagCompound


  }

  public static ItemStack setDefaultEnergyTag(ItemStack container, int energy) {

    if (container.stackTagCompound == null) {
      container.setTagCompound(new NBTTagCompound());
    }
    container.stackTagCompound.setInteger("Energy", energy);

    return container;
  }
View Full Code Here


    return ((IFluidContainerItem) container.getItem()).getFluid(container);
  }

  public static ItemStack setDefaultFluidTag(ItemStack container, FluidStack resource) {

    container.setTagCompound(new NBTTagCompound());
    NBTTagCompound fluidTag = resource.writeToNBT(new NBTTagCompound());
    container.stackTagCompound.setTag("Fluid", fluidTag);

    return container;
  }
View Full Code Here

  public static void writeFluidStackToPacket(FluidStack fluid, DataOutput data) throws IOException {

    if (!isValidFluidStack(fluid)) {
      data.writeShort(-1);
    } else {
      byte[] abyte = CompressedStreamTools.compress(fluid.writeToNBT(new NBTTagCompound()));
      data.writeShort((short) abyte.length);
      data.write(abyte);
    }
  }
View Full Code Here

    if (tile == null) {
      return null;
    }
    if (tag == null) {
      tag = new NBTTagCompound();
    }
    tag.setByte("RSControl", (byte) tile.getControl().ordinal());
    return tag;
  }
View Full Code Here

  }

  public static boolean setControl(ItemStack stack, ControlMode control) {

    if (stack.stackTagCompound == null) {
      stack.setTagCompound(new NBTTagCompound());
    }
    stack.stackTagCompound.setByte("RSControl", (byte) control.ordinal());
    return true;
  }
View Full Code Here

  public static void addFurnaceRecipe(int energy, ItemStack input, ItemStack output) {

    if (input == null || output == null) {
      return;
    }
    NBTTagCompound toSend = new NBTTagCompound();

    toSend.setInteger("energy", energy);
    toSend.setTag("input", new NBTTagCompound());
    toSend.setTag("output", new NBTTagCompound());

    input.writeToNBT(toSend.getCompoundTag("input"));
    output.writeToNBT(toSend.getCompoundTag("output"));
    FMLInterModComms.sendMessage("ThermalExpansion", "FurnaceRecipe", toSend);
  }
View Full Code Here

  public static void addPulverizerRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance) {

    if (input == null || primaryOutput == null) {
      return;
    }
    NBTTagCompound toSend = new NBTTagCompound();

    toSend.setInteger("energy", energy);
    toSend.setTag("input", new NBTTagCompound());
    toSend.setTag("primaryOutput", new NBTTagCompound());

    if (secondaryOutput != null) {
      toSend.setTag("secondaryOutput", new NBTTagCompound());
    }

    input.writeToNBT(toSend.getCompoundTag("input"));
    primaryOutput.writeToNBT(toSend.getCompoundTag("primaryOutput"));

    if (secondaryOutput != null) {
      secondaryOutput.writeToNBT(toSend.getCompoundTag("secondaryOutput"));
      toSend.setInteger("secondaryChance", secondaryChance);
    }

    FMLInterModComms.sendMessage("ThermalExpansion", "PulverizerRecipe", toSend);
  }
View Full Code Here

  public static void addSawmillRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance) {

    if (input == null || primaryOutput == null) {
      return;
    }
    NBTTagCompound toSend = new NBTTagCompound();

    toSend.setInteger("energy", energy);
    toSend.setTag("input", new NBTTagCompound());
    toSend.setTag("primaryOutput", new NBTTagCompound());

    if (secondaryOutput != null) {
      toSend.setTag("secondaryOutput", new NBTTagCompound());
    }

    input.writeToNBT(toSend.getCompoundTag("input"));
    primaryOutput.writeToNBT(toSend.getCompoundTag("primaryOutput"));

    if (secondaryOutput != null) {
      secondaryOutput.writeToNBT(toSend.getCompoundTag("secondaryOutput"));
      toSend.setInteger("secondaryChance", secondaryChance);
    }

    FMLInterModComms.sendMessage("ThermalExpansion", "SawmillRecipe", toSend);
  }
View Full Code Here

      int secondaryChance) {

    if (primaryInput == null || secondaryInput == null || primaryOutput == null) {
      return;
    }
    NBTTagCompound toSend = new NBTTagCompound();

    toSend.setInteger("energy", energy);
    toSend.setTag("primaryInput", new NBTTagCompound());
    toSend.setTag("secondaryInput", new NBTTagCompound());
    toSend.setTag("primaryOutput", new NBTTagCompound());

    if (secondaryOutput != null) {
      toSend.setTag("secondaryOutput", new NBTTagCompound());
    }

    primaryInput.writeToNBT(toSend.getCompoundTag("primaryInput"));
    secondaryInput.writeToNBT(toSend.getCompoundTag("secondaryInput"));
    primaryOutput.writeToNBT(toSend.getCompoundTag("primaryOutput"));

    if (secondaryOutput != null) {
      secondaryOutput.writeToNBT(toSend.getCompoundTag("secondaryOutput"));
      toSend.setInteger("secondaryChance", secondaryChance);
    }

    FMLInterModComms.sendMessage("ThermalExpansion", "SmelterRecipe", toSend);
  }
View Full Code Here

   *
   * @param oreType
   */
  public static void addSmelterBlastOre(String oreType) {

    NBTTagCompound toSend = new NBTTagCompound();

    toSend.setString("oreType", oreType);

    FMLInterModComms.sendMessage("ThermalExpansion", "SmelterBlastOreType", toSend);
  }
View Full Code Here

TOP

Related Classes of net.minecraft.nbt.NBTTagCompound

Copyright © 2018 www.massapicom. 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.