use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntityPressureChamberInterface method writeToNBT.
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
// Write the ItemStacks in the inventory to NBT
NBTTagList tagList = new NBTTagList();
for (int i = 0; i < inventory.length; i++) if (inventory[i] != null) {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", (byte) i);
inventory[i].writeToNBT(tagCompound);
tagList.appendTag(tagCompound);
}
tag.setTag("Items", tagList);
tag.setInteger("outputProgress", outputProgress);
tag.setInteger("inputProgress", inputProgress);
tag.setInteger("interfaceMode", interfaceMode.ordinal());
tag.setInteger("filterMode", filterMode.ordinal());
tag.setInteger("creativeTabID", creativeTabID);
tag.setString("itemNameFilter", itemNameFilter);
tag.setInteger("redstoneMode", redstoneMode);
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntityUniversalSensor method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
setSensorSetting(tag.getString("sensorSetting"));
invertedRedstone = tag.getBoolean("invertedRedstone");
dishSpeed = tag.getFloat("dishSpeed");
sensorGuiText = tag.getString("sensorText");
// Read in the ItemStacks in the inventory from NBT
NBTTagList tagList = tag.getTagList("Items", 10);
inventory = new ItemStack[getSizeInventory()];
for (int i = 0; i < tagList.tagCount(); ++i) {
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
byte slot = tagCompound.getByte("Slot");
if (slot >= 0 && slot < inventory.length) {
inventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
}
}
positions = getGPSPositionsStatic(this, getRange());
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntityVacuumPump method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
vacuumHandler.readFromNBTI(tag.getCompoundTag("vacuum"));
turning = tag.getBoolean("turning");
redstoneMode = tag.getInteger("redstoneMode");
// Read in the ItemStacks in the inventory from NBT
NBTTagList tagList = tag.getTagList("Items", 10);
inventory = new ItemStack[getSizeInventory()];
for (int i = 0; i < tagList.tagCount(); ++i) {
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
byte slot = tagCompound.getByte("Slot");
if (slot >= 0 && slot < inventory.length) {
inventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
}
}
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class TileEntityElevatorBase method writeToNBT.
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
tag.setFloat("extension", extension);
tag.setFloat("targetExtension", targetExtension);
tag.setInteger("redstoneMode", redstoneMode);
tag.setInteger("maxFloorHeight", maxFloorHeight);
for (int i = 0; i < 6; i++) {
tag.setBoolean("sideConnected" + i, sidesConnected[i]);
}
// Write the ItemStacks in the inventory to NBT
NBTTagList tagList = new NBTTagList();
for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) {
if (inventory[currentIndex] != null) {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", (byte) currentIndex);
inventory[currentIndex].writeToNBT(tagCompound);
tagList.appendTag(tagCompound);
}
}
tag.setTag("Items", tagList);
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class ProgrammedDroneUtils method getChargedDispenserUpgradeDrone.
private static EntityDrone getChargedDispenserUpgradeDrone(World world) {
EntityDrone drone = new EntityDrone(world);
NBTTagCompound tag = new NBTTagCompound();
drone.writeEntityToNBT(tag);
NBTTagList upgradeList = new NBTTagList();
NBTTagCompound slotEntry = new NBTTagCompound();
slotEntry.setByte("Slot", (byte) 0);
new ItemStack(Itemss.machineUpgrade, 64, ItemMachineUpgrade.UPGRADE_DISPENSER_DAMAGE).writeToNBT(slotEntry);
upgradeList.appendTag(slotEntry);
slotEntry = new NBTTagCompound();
slotEntry.setByte("Slot", (byte) 1);
new ItemStack(Itemss.machineUpgrade, 10, ItemMachineUpgrade.UPGRADE_SPEED_DAMAGE).writeToNBT(slotEntry);
upgradeList.appendTag(slotEntry);
NBTTagCompound inv = new NBTTagCompound();
inv.setTag("Items", upgradeList);
tag.setTag("Inventory", inv);
tag.setFloat("currentAir", 100000);
drone.readEntityFromNBT(tag);
drone.setCustomNameTag(StatCollector.translateToLocal("drone.amadronDeliveryDrone"));
//Don't let the drone be dropped when wrenching it.
drone.naturallySpawned = true;
return drone;
}
Aggregations