Temporarly fix the tinker chest's crashing those in spectator mode. The inventory will not render right now for those specatating the chest.
@@ -10,8 +10,10 @@ import slimeknights.tconstruct.tables.inventory.TinkerChestContainer;
import slimeknights.tconstruct.tables.tileentity.chest.TinkerChestTileEntity;
public class TinkerChestScreen extends BaseStationScreen<TinkerChestTileEntity, BaseStationContainer<TinkerChestTileEntity>> {
+
protected static final ScalableElementScreen BACKGROUND = new ScalableElementScreen(7 + 18, 7, 18, 18);
public ScalingChestScreen<TinkerChestTileEntity> scalingChestScreen;
+
public TinkerChestScreen(BaseStationContainer<TinkerChestTileEntity> container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
TinkerChestContainer.DynamicChestInventory chestContainer = container.getSubContainer(TinkerChestContainer.DynamicChestInventory.class);
@@ -25,13 +27,19 @@ public class TinkerChestScreen extends BaseStationScreen<TinkerChestTileEntity,
protected void drawGuiContainerBackgroundLayer(MatrixStack matrices, float partialTicks, int mouseX, int mouseY) {
this.drawBackground(matrices, BLANK_BACK);
+ if (this.scalingChestScreen != null) {
this.scalingChestScreen.update(mouseX, mouseY);
+ }
super.drawGuiContainerBackgroundLayer(matrices, partialTicks, mouseX, mouseY);
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
+ if (this.scalingChestScreen == null) {
+ return false;
+ }
+
if (this.scalingChestScreen.handleMouseClicked(mouseX, mouseY, mouseButton)) {
return false;
}
@@ -41,6 +49,10 @@ public class TinkerChestScreen extends BaseStationScreen<TinkerChestTileEntity,
@Override
public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) {
+ if (this.scalingChestScreen == null) {
+ return false;
+ }
+
if (this.scalingChestScreen.handleMouseClickMove(mouseX, mouseY, button, dragX)) {
return false;
}
@@ -50,6 +62,10 @@ public class TinkerChestScreen extends BaseStationScreen<TinkerChestTileEntity,
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
+ if (this.scalingChestScreen == null) {
+ return false;
+ }
+
if (this.scalingChestScreen.handleMouseScrolled(mouseX, mouseY, delta)) {
return false;
}
@@ -59,6 +75,10 @@ public class TinkerChestScreen extends BaseStationScreen<TinkerChestTileEntity,
@Override
public boolean mouseReleased(double mouseX, double mouseY, int state) {
+ if (this.scalingChestScreen == null) {
+ return false;
+ }
+
if (this.scalingChestScreen.handleMouseReleased(mouseX, mouseY, state)) {
return false;
}
