mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-26 14:53:10 +00:00
Migrate storage bus config (#420)
This commit is contained in:
1 parent
a684a07d7c
commit
d89a67d3db
1 file changed
+23
@@ -3,7 +3,14 @@ package com.glodblock.github.common.parts;
|
|||||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
import com.glodblock.github.util.Util;
|
||||||
|
|
||||||
|
import appeng.api.storage.StorageName;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.storage.data.IAEStack;
|
||||||
import appeng.api.storage.data.IAEStackType;
|
import appeng.api.storage.data.IAEStackType;
|
||||||
import appeng.parts.misc.PartStorageBus;
|
import appeng.parts.misc.PartStorageBus;
|
||||||
|
|
||||||
@@ -17,4 +24,20 @@ public class PartFluidStorageBus extends PartStorageBus {
|
|||||||
public IAEStackType<?> getStackType() {
|
public IAEStackType<?> getStackType() {
|
||||||
return FLUID_STACK_TYPE;
|
return FLUID_STACK_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound data) {
|
||||||
|
super.readFromNBT(data);
|
||||||
|
|
||||||
|
// Migrate from old data
|
||||||
|
var config = this.getAEInventoryByName(StorageName.CONFIG);
|
||||||
|
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||||
|
IAEStack<?> stack = config.getAEStackInSlot(i);
|
||||||
|
|
||||||
|
if (stack instanceof IAEItemStack ais) {
|
||||||
|
IAEFluidStack afs = Util.getAEFluidFromItem(ais.getItemStack());
|
||||||
|
config.putAEStackInSlot(i, afs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user