public void writeToNBT(NBTTagCompound nbtRoot) {
super.writeToNBT(nbtRoot);
for (Entry<ForgeDirection, IItemFilter> entry : inputFilters.entrySet()) {
if(entry.getValue() != null) {
IItemFilter f = entry.getValue();
if(!isDefault(f)) {
NBTTagCompound itemRoot = new NBTTagCompound();
FilterRegister.writeFilterToNbt(f, itemRoot);
nbtRoot.setTag("inFilts." + entry.getKey().name(), itemRoot);
}
}
}
for (Entry<ForgeDirection, ItemStack> entry : speedUpgrades.entrySet()) {
if(entry.getValue() != null) {
ItemStack up = entry.getValue();
NBTTagCompound itemRoot = new NBTTagCompound();
up.writeToNBT(itemRoot);
nbtRoot.setTag("speedUpgrades." + entry.getKey().name(), itemRoot);
}
}
for (Entry<ForgeDirection, IItemFilter> entry : outputFilters.entrySet()) {
if(entry.getValue() != null) {
IItemFilter f = entry.getValue();
if(!isDefault(f)) {
NBTTagCompound itemRoot = new NBTTagCompound();
FilterRegister.writeFilterToNbt(f, itemRoot);
nbtRoot.setTag("outFilts." + entry.getKey().name(), itemRoot);
}
}
}
for (Entry<ForgeDirection, ItemStack> entry : inputFilterUpgrades.entrySet()) {
if(entry.getValue() != null) {
ItemStack up = entry.getValue();
IItemFilter filter = getInputFilter(entry.getKey());
FilterRegister.writeFilterToStack(filter, up);
NBTTagCompound itemRoot = new NBTTagCompound();
up.writeToNBT(itemRoot);
nbtRoot.setTag("inputFilterUpgrades." + entry.getKey().name(), itemRoot);
}
}
for (Entry<ForgeDirection, ItemStack> entry : outputFilterUpgrades.entrySet()) {
if(entry.getValue() != null) {
ItemStack up = entry.getValue();
IItemFilter filter = getOutputFilter(entry.getKey());
FilterRegister.writeFilterToStack(filter, up);
NBTTagCompound itemRoot = new NBTTagCompound();
up.writeToNBT(itemRoot);
nbtRoot.setTag("outputFilterUpgrades." + entry.getKey().name(), itemRoot);