Fixed not being able to change the Exporter filter slot count with regulator mode without closing and re-opening the container.

This commit is contained in:
raoulvdberge
2020-11-11 20:06:05 +01:00
parent e87184d2c8
commit 8e8c1ab04f
2 changed files with 19 additions and 0 deletions

View File

@@ -6,6 +6,7 @@
- Fixed issue where Crafters may fail to recognize an inventory/tank for some patterns (Darkere) - Fixed issue where Crafters may fail to recognize an inventory/tank for some patterns (Darkere)
- Fixed issue where the Crafter Manager can crash on invalid patterns (raoulvdberge) - Fixed issue where the Crafter Manager can crash on invalid patterns (raoulvdberge)
- Fixed issue where alternatives in the Pattern Grid weren't being saved properly (raoulvdberge) - Fixed issue where alternatives in the Pattern Grid weren't being saved properly (raoulvdberge)
- Fixed not being able to change the Exporter filter slot count with regulator mode without closing and re-opening the container (raoulvdberge)
### 1.9.8 ### 1.9.8

View File

@@ -11,15 +11,33 @@ import net.minecraftforge.items.SlotItemHandler;
public class ExporterContainer extends BaseContainer { public class ExporterContainer extends BaseContainer {
private final ExporterTile exporter; private final ExporterTile exporter;
private boolean hasRegulatorMode;
public ExporterContainer(ExporterTile exporter, PlayerEntity player, int windowId) { public ExporterContainer(ExporterTile exporter, PlayerEntity player, int windowId) {
super(RSContainers.EXPORTER, exporter, player, windowId); super(RSContainers.EXPORTER, exporter, player, windowId);
this.exporter = exporter; this.exporter = exporter;
this.hasRegulatorMode = hasRegulatorMode();
initSlots(); initSlots();
} }
private boolean hasRegulatorMode() {
return exporter.getNode().getUpgrades().hasUpgrade(UpgradeItem.Type.REGULATOR);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
boolean updatedHasRegulatorMode = hasRegulatorMode();
if (hasRegulatorMode != updatedHasRegulatorMode) {
hasRegulatorMode = updatedHasRegulatorMode;
initSlots();
}
}
public void initSlots() { public void initSlots() {
this.inventorySlots.clear(); this.inventorySlots.clear();
this.inventoryItemStacks.clear(); this.inventoryItemStacks.clear();