Fixed crash on pressing alt key on schematic screen

This commit is contained in:
grimmauld 2020-10-04 14:16:05 +02:00
parent 5993c30a3e
commit eda8bfd0a1
3 changed files with 18 additions and 8 deletions

View file

@ -182,7 +182,7 @@ public class SchematicHandler {
}
public void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
public void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay, float partialTicks) {
if (!active)
return;
if (activeSchematicItem != null)
@ -190,8 +190,7 @@ public class SchematicHandler {
currentTool.getTool()
.renderOverlay(ms, buffer);
selectionScreen.renderPassive(ms, Minecraft.getInstance()
.getRenderPartialTicks());
selectionScreen.renderPassive(ms, partialTicks);
}
public void onMouseInput(int button, boolean pressed) {

View file

@ -129,13 +129,13 @@ public class ClientEvents {
if (event.getType() != ElementType.HOTBAR)
return;
onRenderHotbar(new MatrixStack(), Minecraft.getInstance()
onRenderHotbar(event.getMatrixStack(), Minecraft.getInstance()
.getBufferBuilders()
.getEntityVertexConsumers(), 0xF000F0, OverlayTexture.DEFAULT_UV);
.getEntityVertexConsumers(), 0xF000F0, OverlayTexture.DEFAULT_UV, event.getPartialTicks());
}
public static void onRenderHotbar(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
CreateClient.schematicHandler.renderOverlay(ms, buffer, light, overlay);
public static void onRenderHotbar(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay, float partialTicks) {
CreateClient.schematicHandler.renderOverlay(ms, buffer, light, overlay, partialTicks);
}
@SubscribeEvent

View file

@ -25,6 +25,7 @@ public class ToolSelectionScreen extends Screen {
public boolean focused;
private float yOffset;
protected int selection;
private boolean initialized;
protected int w;
protected int h;
@ -37,6 +38,7 @@ public class ToolSelectionScreen extends Screen {
focused = false;
yOffset = 0;
selection = 0;
initialized = false;
callback.accept(tools.get(selection));
@ -56,7 +58,11 @@ public class ToolSelectionScreen extends Screen {
}
private void draw(MatrixStack matrixStack, float partialTicks) {
MainWindow mainWindow = Minecraft.getInstance().getWindow();
Minecraft mc = Minecraft.getInstance();
MainWindow mainWindow = mc.getWindow();
if (!initialized)
init(mc, mainWindow.getScaledWidth(), mainWindow.getScaledHeight());
int x = (mainWindow.getScaledWidth() - w) / 2 + 15;
int y = mainWindow.getScaledHeight() - h - 75;
@ -140,4 +146,9 @@ public class ToolSelectionScreen extends Screen {
callback.accept(tools.get(selection));
}
@Override
protected void init() {
super.init();
initialized = true;
}
}