Storage saving fixes
This commit is contained in:
@@ -85,10 +85,6 @@ public class BlockStorage extends BlockSlave {
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
TileStorage storage = (TileStorage) world.getTileEntity(pos);
|
||||
|
||||
if (storage.getStorage() != null) {
|
||||
storage.getStorage().writeToNBT();
|
||||
}
|
||||
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
|
||||
ItemStack stack = new ItemStack(RefinedStorageBlocks.STORAGE, 1, RefinedStorageBlocks.STORAGE.getMetaFromState(state));
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
@@ -97,6 +98,17 @@ public class TileDiskDrive extends TileSlave implements IStorageProvider, IStora
|
||||
public void updateSlave() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnect(World world) {
|
||||
super.disconnect(world);
|
||||
|
||||
for (Storage storage : this.storages) {
|
||||
if (storage != null) {
|
||||
storage.writeToNBT();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provide(List<IStorage> storages) {
|
||||
for (IStorage storage : this.storages) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.RefinedStorage;
|
||||
@@ -78,6 +79,15 @@ public class TileStorage extends TileSlave implements IStorageProvider, IStorage
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnect(World world) {
|
||||
super.disconnect(world);
|
||||
|
||||
if (storage != null) {
|
||||
storage.writeToNBT();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provide(List<IStorage> storages) {
|
||||
if (storage != null) {
|
||||
|
||||
Reference in New Issue
Block a user