mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-01 01:46:39 +01:00
Fixed crash on pressing alt key on schematic screen
This commit is contained in:
parent
5993c30a3e
commit
eda8bfd0a1
3 changed files with 18 additions and 8 deletions
|
@ -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)
|
if (!active)
|
||||||
return;
|
return;
|
||||||
if (activeSchematicItem != null)
|
if (activeSchematicItem != null)
|
||||||
|
@ -190,8 +190,7 @@ public class SchematicHandler {
|
||||||
|
|
||||||
currentTool.getTool()
|
currentTool.getTool()
|
||||||
.renderOverlay(ms, buffer);
|
.renderOverlay(ms, buffer);
|
||||||
selectionScreen.renderPassive(ms, Minecraft.getInstance()
|
selectionScreen.renderPassive(ms, partialTicks);
|
||||||
.getRenderPartialTicks());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onMouseInput(int button, boolean pressed) {
|
public void onMouseInput(int button, boolean pressed) {
|
||||||
|
|
|
@ -129,13 +129,13 @@ public class ClientEvents {
|
||||||
if (event.getType() != ElementType.HOTBAR)
|
if (event.getType() != ElementType.HOTBAR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
onRenderHotbar(new MatrixStack(), Minecraft.getInstance()
|
onRenderHotbar(event.getMatrixStack(), Minecraft.getInstance()
|
||||||
.getBufferBuilders()
|
.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) {
|
public static void onRenderHotbar(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay, float partialTicks) {
|
||||||
CreateClient.schematicHandler.renderOverlay(ms, buffer, light, overlay);
|
CreateClient.schematicHandler.renderOverlay(ms, buffer, light, overlay, partialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class ToolSelectionScreen extends Screen {
|
||||||
public boolean focused;
|
public boolean focused;
|
||||||
private float yOffset;
|
private float yOffset;
|
||||||
protected int selection;
|
protected int selection;
|
||||||
|
private boolean initialized;
|
||||||
|
|
||||||
protected int w;
|
protected int w;
|
||||||
protected int h;
|
protected int h;
|
||||||
|
@ -37,6 +38,7 @@ public class ToolSelectionScreen extends Screen {
|
||||||
focused = false;
|
focused = false;
|
||||||
yOffset = 0;
|
yOffset = 0;
|
||||||
selection = 0;
|
selection = 0;
|
||||||
|
initialized = false;
|
||||||
|
|
||||||
callback.accept(tools.get(selection));
|
callback.accept(tools.get(selection));
|
||||||
|
|
||||||
|
@ -56,7 +58,11 @@ public class ToolSelectionScreen extends Screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void draw(MatrixStack matrixStack, float partialTicks) {
|
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 x = (mainWindow.getScaledWidth() - w) / 2 + 15;
|
||||||
int y = mainWindow.getScaledHeight() - h - 75;
|
int y = mainWindow.getScaledHeight() - h - 75;
|
||||||
|
@ -140,4 +146,9 @@ public class ToolSelectionScreen extends Screen {
|
||||||
callback.accept(tools.get(selection));
|
callback.accept(tools.get(selection));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
super.init();
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue