Fixed drawer controllers not working with external storage
This commit is contained in:
@@ -37,7 +37,7 @@ public class BlockExternalStorage extends BlockSlave {
|
||||
super.neighborChanged(state, world, pos, block);
|
||||
|
||||
if (!world.isRemote) {
|
||||
((TileExternalStorage) world.getTileEntity(pos)).refreshStorage();
|
||||
((TileExternalStorage) world.getTileEntity(pos)).updateStorage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -40,6 +40,7 @@ public class TileExternalStorage extends TileSlave implements IStorageProvider,
|
||||
private int capacity;
|
||||
|
||||
private List<ExternalStorage> storages = new ArrayList<ExternalStorage>();
|
||||
private int lastDrawerCount;
|
||||
|
||||
@Override
|
||||
public int getEnergyUsage() {
|
||||
@@ -50,6 +51,17 @@ public class TileExternalStorage extends TileSlave implements IStorageProvider,
|
||||
public void updateSlave() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if (getFacingTile() instanceof IDrawerGroup && lastDrawerCount != ((IDrawerGroup) getFacingTile()).getDrawerCount()) {
|
||||
lastDrawerCount = ((IDrawerGroup) getFacingTile()).getDrawerCount();
|
||||
|
||||
updateStorage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeContainerData(ByteBuf buf) {
|
||||
super.writeContainerData(buf);
|
||||
@@ -144,8 +156,8 @@ public class TileExternalStorage extends TileSlave implements IStorageProvider,
|
||||
markDirty();
|
||||
}
|
||||
|
||||
// Called when the neighbor block changes
|
||||
public void refreshStorage() {
|
||||
// Called when the neighbor block changes or when a drawer is added or removed to a drawer group
|
||||
public void updateStorage() {
|
||||
storages.clear();
|
||||
|
||||
TileEntity facing = getFacingTile();
|
||||
|
Reference in New Issue
Block a user