use of net.minecraft.nbt.NBTTagCompound in project OpenLights by PC-Logix.
the class TileEntitySidedEnvironment method writeToNBT.
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
int index = 0;
for (Node node : nodes) {
// See readFromNBT() regarding host check.
if (node != null && node.host() == this) {
final NBTTagCompound nodeNbt = new NBTTagCompound();
node.save(nodeNbt);
nbt.setTag("oc:node" + index, nodeNbt);
}
++index;
}
}
use of net.minecraft.nbt.NBTTagCompound in project Witchworks by Um-Mitternacht.
the class BrewUtils method createBrew.
public static ItemStack createBrew(Item item, BrewEffect... effects) {
ItemStack stack = new ItemStack(item);
NBTTagList list = addBrewData(stack);
for (BrewEffect effect : effects) {
NBTTagCompound tag = new NBTTagCompound();
IBrew brew = effect.getBrew();
tag.setInteger(BREW_ID, BrewRegistry.getBrewId(brew));
tag.setInteger(BREW_AMPLIFIER, effect.getAmplifier());
tag.setInteger(BREW_DURATION, effect.getDuration());
list.appendTag(tag);
}
return stack;
}
use of net.minecraft.nbt.NBTTagCompound in project Witchworks by Um-Mitternacht.
the class BrewUtils method serialize.
public static NBTTagCompound serialize(Collection<Object> collection) {
List<BrewEffect> brewEffects = new ArrayList<>();
List<PotionEffect> potionEffects = new ArrayList<>();
for (Object brew : collection) {
if (brew instanceof BrewEffect) {
brewEffects.add((BrewEffect) brew);
} else if (brew instanceof PotionEffect) {
potionEffects.add((PotionEffect) brew);
}
}
NBTTagCompound compound = new NBTTagCompound();
appendPotions(compound, mixPotions(potionEffects));
appendBrews(compound, mixBrews(brewEffects));
return compound;
}
use of net.minecraft.nbt.NBTTagCompound in project Witchworks by Um-Mitternacht.
the class BrewUtils method appendPotions.
public static void appendPotions(NBTTagCompound tag, Collection<PotionEffect> effects) {
NBTTagList tagList = tag.getTagList("CustomPotionEffects", 9);
for (PotionEffect potioneffect : effects) {
tagList.appendTag(potioneffect.writeCustomPotionEffectToNBT(new NBTTagCompound()));
}
tag.setTag("CustomPotionEffects", tagList);
}
use of net.minecraft.nbt.NBTTagCompound in project Witchworks by Um-Mitternacht.
the class RitualHolder method writeNBT.
public void writeNBT(NBTTagCompound cmp) {
NBTTagCompound tag = new NBTTagCompound();
tag.setInteger("ritual", KettleRegistry.getRituals().indexOf(ritual));
tag.setInteger("energy_left", energy_left);
tag.setInteger("ticks", ticks);
tag.setBoolean("fail", fail);
cmp.setTag("ritual_data", tag);
}
Aggregations