From 0c05fa4edc4558bd33176acff66b1fa70af906b7 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Tue, 24 Aug 2021 00:20:33 +0900 Subject: Optimized Mechanic Browser - As expected setBounds call to MScalablePanel is expensive --- .../features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java | 1 + .../features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java index 7b8309ed..21898427 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java @@ -182,6 +182,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(FeatureMechanicBrowse.this.getParameter("scale").getValue()) {{ setOnUpdate(() ->{ FeatureMechanicBrowse.this.getParameter("scale").setValue(this.getData()); + mGuiMechanicBrowser.initGui(); }); } })); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java index 6ef99866..27d5e583 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java @@ -34,12 +34,12 @@ public class MGuiMechanicBrowser extends MGui { @Override public void initGui() { super.initGui(); + panelMechanicBrowser.setBounds(featureMechanicBrowse.getFeatureRect().getRectangle()); + panelMechanicBrowser.setScale(featureMechanicBrowse.getScale()); } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - panelMechanicBrowser.setBounds(featureMechanicBrowse.getFeatureRect().getRectangle()); - panelMechanicBrowser.setScale(featureMechanicBrowse.getScale()); super.drawScreen(mouseX, mouseY, partialTicks); } } -- cgit