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