use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.
the class ItemNBTHelper method setLore.
public static void setLore(ItemStack stack, String... lore) {
NBTTagCompound displayTag = getTagCompound(stack, "display");
NBTTagList list = new NBTTagList();
for (String s : lore) list.appendTag(new NBTTagString(s));
displayTag.setTag("Lore", list);
setTagCompound(stack, "display", displayTag);
}
use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.
the class ItemInternalStorage method getContainedItems.
@Override
public ItemStack[] getContainedItems(ItemStack stack) {
ItemStack[] stackList = new ItemStack[getInternalSlots(stack)];
if (stack.hasTagCompound()) {
NBTTagList inv = stack.getTagCompound().getTagList("Inv", 10);
for (int i = 0; i < inv.tagCount(); i++) {
NBTTagCompound tag = inv.getCompoundTagAt(i);
int slot = tag.getByte("Slot") & 0xFF;
if ((slot >= 0) && (slot < stackList.length))
stackList[slot] = ItemStack.loadItemStackFromNBT(tag);
}
}
return stackList;
}
use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.
the class TileEntityImmersiveConnectable method writeConnsToNBT.
private void writeConnsToNBT(NBTTagCompound nbt) {
if (worldObj != null && !worldObj.isRemote && nbt != null) {
NBTTagList connectionList = new NBTTagList();
Set<Connection> conL = ImmersiveNetHandler.INSTANCE.getConnections(worldObj, Utils.toCC(this));
if (conL != null)
for (Connection con : conL) connectionList.appendTag(con.writeToNBT());
nbt.setTag("connectionList", connectionList);
}
}
use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.
the class MixerRecipe method writeToNBT.
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
nbt.setTag("fluidInput", fluidInput.writeToNBT(new NBTTagCompound()));
if (this.itemInputs.length > 0) {
NBTTagList list = new NBTTagList();
for (IngredientStack add : this.itemInputs) list.appendTag(add.writeToNBT(new NBTTagCompound()));
nbt.setTag("itemInputs", list);
}
return nbt;
}
use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.
the class TileEntityImmersiveConnectable method loadConnsFromNBT.
private void loadConnsFromNBT(NBTTagCompound nbt) {
if (worldObj != null && worldObj.isRemote && !Minecraft.getMinecraft().isSingleplayer() && nbt != null) {
NBTTagList connectionList = nbt.getTagList("connectionList", 10);
ImmersiveNetHandler.INSTANCE.clearConnectionsOriginatingFrom(Utils.toCC(this), worldObj);
for (int i = 0; i < connectionList.tagCount(); i++) {
NBTTagCompound conTag = connectionList.getCompoundTagAt(i);
Connection con = Connection.readFromNBT(conTag);
if (con != null) {
ImmersiveNetHandler.INSTANCE.addConnection(worldObj, Utils.toCC(this), con);
} else
IELogger.error("CLIENT read connection as null");
}
}
}
Aggregations