From 1956b16fb90e286175b94448f34d8877fe77a295 Mon Sep 17 00:00:00 2001 From: Cedric Date: Fri, 21 Jun 2024 14:36:29 +0200 Subject: [PATCH] fix: some UI issues --- .../com/troblecodings/signals/guis/ContainerSignalBox.java | 5 +++-- .../java/com/troblecodings/signals/guis/GuiSignalBox.java | 2 +- src/main/java/com/troblecodings/signals/guis/SidePanel.java | 2 +- .../com/troblecodings/signals/guis/SignalBoxUIHelper.java | 2 +- .../java/com/troblecodings/signals/guis/UISignalBoxTile.java | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/troblecodings/signals/guis/ContainerSignalBox.java b/src/main/java/com/troblecodings/signals/guis/ContainerSignalBox.java index a481fa1d9..946f20d83 100644 --- a/src/main/java/com/troblecodings/signals/guis/ContainerSignalBox.java +++ b/src/main/java/com/troblecodings/signals/guis/ContainerSignalBox.java @@ -58,6 +58,7 @@ public class ContainerSignalBox extends ContainerBase implements UIClientSync, I private Consumer> signalUpdates; private Runnable counterUpdater; private Consumer> trainNumberUpdater; + private EntityPlayer player; public ContainerSignalBox(final GuiInfo info) { super(info); @@ -491,8 +492,8 @@ public Map getPositionForTypes() { public boolean canInteractWith(final EntityPlayer playerIn) { if (tile.isBlocked() && !tile.isValid(playerIn)) return false; - if (this.info.player == null) { - this.info.player = playerIn; + if (this.player == null) { + this.player = playerIn; this.tile.add(this); } return true; diff --git a/src/main/java/com/troblecodings/signals/guis/GuiSignalBox.java b/src/main/java/com/troblecodings/signals/guis/GuiSignalBox.java index 95b87eda0..cce1f441b 100644 --- a/src/main/java/com/troblecodings/signals/guis/GuiSignalBox.java +++ b/src/main/java/com/troblecodings/signals/guis/GuiSignalBox.java @@ -554,7 +554,7 @@ private void initializeFieldTemplate(final BiConsumer plane.setWidth(TILE_COUNT * TILE_WIDTH); plane.setHeight(TILE_COUNT * TILE_WIDTH); splitter.add(new UIScroll(s -> { - final float newScale = (float) (plane.getScaleX() + s * 0.05f); + final float newScale = (float) (plane.getScaleX() + s * 0.001f); if (newScale <= 0) return; plane.setScaleX(newScale); diff --git a/src/main/java/com/troblecodings/signals/guis/SidePanel.java b/src/main/java/com/troblecodings/signals/guis/SidePanel.java index d67df1d47..880f46c42 100644 --- a/src/main/java/com/troblecodings/signals/guis/SidePanel.java +++ b/src/main/java/com/troblecodings/signals/guis/SidePanel.java @@ -85,7 +85,7 @@ public SidePanel(final UIEntity lowerEntity, final GuiSignalBox gui) { helpPage.add(new UIBox(UIBox.VBOX, 2)); final UIRotate rotate = new UIRotate(); - rotate.setRotateZ((float) Math.PI / 2.0f); + rotate.setRotateZ((float) 90); label.add(rotate); final UILabel labelComponent = new UILabel(I18Wrapper.format("info.infolabel")); labelComponent.setTextColor(new UIEntity().getBasicTextColor()); diff --git a/src/main/java/com/troblecodings/signals/guis/SignalBoxUIHelper.java b/src/main/java/com/troblecodings/signals/guis/SignalBoxUIHelper.java index b7b6ab4f7..7124fec11 100644 --- a/src/main/java/com/troblecodings/signals/guis/SignalBoxUIHelper.java +++ b/src/main/java/com/troblecodings/signals/guis/SignalBoxUIHelper.java @@ -33,7 +33,7 @@ public static void initializeGrid(final UIEntity entity, final SignalBoxGrid gri plane.setHeight(GuiSignalBox.TILE_COUNT * GuiSignalBox.TILE_WIDTH); plane.setScale(0.5f); splitter.add(new UIScroll(s -> { - final float newScale = (float) (plane.getScaleX() + s * 0.05f); + final float newScale = (float) (plane.getScaleX() + s * 0.001f); if (newScale <= 0) return; plane.setScaleX(newScale); diff --git a/src/main/java/com/troblecodings/signals/guis/UISignalBoxTile.java b/src/main/java/com/troblecodings/signals/guis/UISignalBoxTile.java index 3ca400db4..34c743987 100644 --- a/src/main/java/com/troblecodings/signals/guis/UISignalBoxTile.java +++ b/src/main/java/com/troblecodings/signals/guis/UISignalBoxTile.java @@ -85,7 +85,7 @@ private void localAdd(final ModeSet modeSet) { final UIEntity entity = new UIEntity(); if (!modeSet.rotation.equals(Rotation.NONE)) { final UIRotate rotation = new UIRotate(); - rotation.setRotateZ(modeSet.rotation.ordinal() * ((float) Math.PI / 2.0f)); + rotation.setRotateZ(modeSet.rotation.ordinal() * ((float) 90)); entity.add(rotation); } entity.add(new UIIndependentTranslate(0, 0, 1));