diff --git a/shared/src/main/java/net/blay09/mods/craftingtweaks/api/CraftingTweaksButtonStyles.java b/shared/src/main/java/net/blay09/mods/craftingtweaks/api/CraftingTweaksButtonStyles.java index 8b74a38..de11896 100644 --- a/shared/src/main/java/net/blay09/mods/craftingtweaks/api/CraftingTweaksButtonStyles.java +++ b/shared/src/main/java/net/blay09/mods/craftingtweaks/api/CraftingTweaksButtonStyles.java @@ -55,54 +55,54 @@ public class CraftingTweaksButtonStyles { public static final ButtonStyle SMALL_WIDTH = new ButtonStyle() .withTweak(TweakType.Rotate, new ButtonProperties(10, 16) - .withState(ButtonState.NORMAL, 16, 78) - .withState(ButtonState.HOVER, 26, 78) - .withState(ButtonState.DISABLED, 36, 78)) + .withState(ButtonState.NORMAL, 10, 78) + .withState(ButtonState.HOVER, 10, 94) + .withState(ButtonState.DISABLED, 10, 110)) .withTweak(TweakType.Clear, new ButtonProperties(10, 16) - .withState(ButtonState.NORMAL, 16, 94) - .withState(ButtonState.HOVER, 26, 94) - .withState(ButtonState.DISABLED, 36, 94)) + .withState(ButtonState.NORMAL, 20, 78) + .withState(ButtonState.HOVER, 20, 94) + .withState(ButtonState.DISABLED, 30, 110)) .withTweak(TweakType.Balance, new ButtonProperties(10, 16) - .withState(ButtonState.NORMAL, 16, 110) - .withState(ButtonState.HOVER, 26, 110) - .withState(ButtonState.DISABLED, 36, 110)) + .withState(ButtonState.NORMAL, 30, 78) + .withState(ButtonState.HOVER, 30, 94) + .withState(ButtonState.DISABLED, 30, 110)) .withTweak(TweakType.RotateCounterClockwise, new ButtonProperties(10, 16) - .withState(ButtonState.NORMAL, 16, 126) - .withState(ButtonState.HOVER, 26, 126) - .withState(ButtonState.DISABLED, 36, 126)) + .withState(ButtonState.NORMAL, 40, 78) + .withState(ButtonState.HOVER, 40, 94) + .withState(ButtonState.DISABLED, 40, 110)) .withTweak(TweakType.ForceClear, new ButtonProperties(10, 16) - .withState(ButtonState.NORMAL, 16, 142) - .withState(ButtonState.HOVER, 26, 142) - .withState(ButtonState.DISABLED, 36, 142)) + .withState(ButtonState.NORMAL, 50, 78) + .withState(ButtonState.HOVER, 50, 94) + .withState(ButtonState.DISABLED, 50, 110)) .withTweak(TweakType.Spread, new ButtonProperties(10, 16) - .withState(ButtonState.NORMAL, 16, 158) - .withState(ButtonState.HOVER, 26, 158) - .withState(ButtonState.DISABLED, 36, 158)); + .withState(ButtonState.NORMAL, 60, 78) + .withState(ButtonState.HOVER, 60, 94) + .withState(ButtonState.DISABLED, 60, 158110)); public static final ButtonStyle SMALL = new ButtonStyle() .withTweak(TweakType.Rotate, new ButtonProperties(10, 10) - .withState(ButtonState.NORMAL, 16, 126) - .withState(ButtonState.HOVER, 26, 126) - .withState(ButtonState.DISABLED, 36, 126)) + .withState(ButtonState.NORMAL, 10, 126) + .withState(ButtonState.HOVER, 10, 136) + .withState(ButtonState.DISABLED, 10, 146)) .withTweak(TweakType.Clear, new ButtonProperties(10, 10) - .withState(ButtonState.NORMAL, 16, 136) - .withState(ButtonState.HOVER, 26, 136) - .withState(ButtonState.DISABLED, 36, 136)) + .withState(ButtonState.NORMAL, 20, 126) + .withState(ButtonState.HOVER, 20, 136) + .withState(ButtonState.DISABLED, 20, 146)) .withTweak(TweakType.Balance, new ButtonProperties(10, 10) - .withState(ButtonState.NORMAL, 16, 146) - .withState(ButtonState.HOVER, 26, 146) - .withState(ButtonState.DISABLED, 36, 146)) + .withState(ButtonState.NORMAL, 30, 126) + .withState(ButtonState.HOVER, 30, 136) + .withState(ButtonState.DISABLED, 30, 146)) .withTweak(TweakType.RotateCounterClockwise, new ButtonProperties(10, 10) - .withState(ButtonState.NORMAL, 16, 156) - .withState(ButtonState.HOVER, 26, 156) - .withState(ButtonState.DISABLED, 36, 156)) + .withState(ButtonState.NORMAL, 40, 126) + .withState(ButtonState.HOVER, 40, 136) + .withState(ButtonState.DISABLED, 40, 146)) .withTweak(TweakType.ForceClear, new ButtonProperties(10, 10) - .withState(ButtonState.NORMAL, 16, 166) - .withState(ButtonState.HOVER, 26, 166) - .withState(ButtonState.DISABLED, 36, 166)) + .withState(ButtonState.NORMAL, 50, 126) + .withState(ButtonState.HOVER, 50, 136) + .withState(ButtonState.DISABLED, 50, 146)) .withTweak(TweakType.Spread, new ButtonProperties(10, 10) - .withState(ButtonState.NORMAL, 16, 176) - .withState(ButtonState.HOVER, 26, 176) - .withState(ButtonState.DISABLED, 36, 176)); + .withState(ButtonState.NORMAL, 60, 126) + .withState(ButtonState.HOVER, 60, 136) + .withState(ButtonState.DISABLED, 60, 146)); } diff --git a/shared/src/main/java/net/blay09/mods/craftingtweaks/registry/CraftingTweaksRegistrationData.java b/shared/src/main/java/net/blay09/mods/craftingtweaks/registry/CraftingTweaksRegistrationData.java index 1dcc910..8231a14 100644 --- a/shared/src/main/java/net/blay09/mods/craftingtweaks/registry/CraftingTweaksRegistrationData.java +++ b/shared/src/main/java/net/blay09/mods/craftingtweaks/registry/CraftingTweaksRegistrationData.java @@ -56,6 +56,7 @@ public void setButtonY(Integer buttonY) { private Integer buttonOffsetX; private Integer buttonOffsetY; private String alignToGrid = "left"; + private String buttonStyle = "default"; private boolean hideButtons; private boolean phantomItems; private TweakData tweakRotate = new TweakData(); @@ -146,6 +147,14 @@ public void setAlignToGrid(String alignToGrid) { this.alignToGrid = alignToGrid; } + public String getButtonStyle() { + return buttonStyle; + } + + public void setButtonStyle(String buttonStyle) { + this.buttonStyle = buttonStyle; + } + public boolean isHideButtons() { return hideButtons; } diff --git a/shared/src/main/java/net/blay09/mods/craftingtweaks/registry/DataDrivenGridFactory.java b/shared/src/main/java/net/blay09/mods/craftingtweaks/registry/DataDrivenGridFactory.java index b8863ea..be9752f 100644 --- a/shared/src/main/java/net/blay09/mods/craftingtweaks/registry/DataDrivenGridFactory.java +++ b/shared/src/main/java/net/blay09/mods/craftingtweaks/registry/DataDrivenGridFactory.java @@ -115,6 +115,16 @@ public int getGridStartSlot(Player player, AbstractContainerMenu menu) { } grid.setButtonAlignment(alignToGrid); + ButtonStyle buttonStyle = CraftingTweaksButtonStyles.DEFAULT; + String buttonStyleName = data.getButtonStyle(); + switch (buttonStyleName.toLowerCase()) { + case "default" -> buttonStyle = CraftingTweaksButtonStyles.DEFAULT; + case "small_width" -> buttonStyle = CraftingTweaksButtonStyles.SMALL_WIDTH; + case "small_height" -> buttonStyle = CraftingTweaksButtonStyles.SMALL_HEIGHT; + case "small" -> buttonStyle = CraftingTweaksButtonStyles.SMALL; + } + grid.setButtonStyle(buttonStyle); + if (data.isHideButtons()) { grid.hideAllTweakButtons(); }