Skip to content

Commit 9f446e6

Browse files
committed
static event listener -> instanced
1 parent 61bb434 commit 9f446e6

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ charset = utf-8
33
end_of_line = crlf
44
indent_size = 4
55
indent_style = space
6-
insert_final_newline = false
6+
insert_final_newline = true
77
max_line_length = 120
88
tab_width = 4
99
ij_continuation_indent_size = 8

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ accessTransformersFile =
6666
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
6767
usesMixins = true
6868
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
69-
mixinsPackage = core.mixin
69+
mixinsPackage = core.mixins
7070
# Automatically generates a mixin config json if enabled, with the name mixins.modid.json
7171
generateMixinConfig = false
7272
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!

src/main/java/com/cleanroommc/modularui/CommonProxy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class CommonProxy {
3232

3333
void preInit(FMLPreInitializationEvent event) {
3434
MinecraftForge.EVENT_BUS.register(this);
35-
MinecraftForge.EVENT_BUS.register(GuiManager.class);
35+
MinecraftForge.EVENT_BUS.register(new GuiManager());
3636

3737
if (ModularUIConfig.enableTestGuis) {
3838
MinecraftForge.EVENT_BUS.register(TestBlock.class);
@@ -84,7 +84,7 @@ public void onConfigChange(ConfigChangedEvent.OnConfigChangedEvent event) {
8484
}
8585

8686
@SubscribeEvent
87-
public static void onTick(TickEvent.PlayerTickEvent event) {
87+
public void onTick(TickEvent.PlayerTickEvent event) {
8888
if (event.player.openContainer instanceof ModularContainer container) {
8989
container.onUpdate();
9090
}

src/main/java/com/cleanroommc/modularui/factory/GuiManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static void openScreen(ModularScreen screen, UISettings settings) {
139139
}
140140

141141
@SubscribeEvent
142-
public static void onTick(TickEvent.ServerTickEvent event) {
142+
public void onTick(TickEvent.ServerTickEvent event) {
143143
if (event.phase == TickEvent.Phase.END) {
144144
openedContainers.clear();
145145
}

src/main/java/com/cleanroommc/modularui/screen/ClientScreenHandler.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ public class ClientScreenHandler {
7979
private static long ticks = 0L;
8080

8181
private static IMuiScreen lastMui;
82-
82+
8383
public static boolean guiIsClosing;
8484

8585
// we need to know the actual gui and not some fake bs some other mod overwrites
8686
@SubscribeEvent(priority = EventPriority.LOWEST)
87-
public static void onGuiOpen(GuiOpenEvent event) {
87+
public void onGuiOpen(GuiOpenEvent event) {
8888
GuiScreen newGui = event.getGui();
8989
guiIsClosing = newGui == null;
90-
90+
9191
defaultContext.reset();
9292
if (lastMui != null && newGui == null) {
9393
if (lastMui.getScreen().getPanelManager().isOpen()) {
@@ -130,7 +130,7 @@ public static void onGuiOpen(GuiOpenEvent event) {
130130
}
131131

132132
@SubscribeEvent
133-
public static void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) {
133+
public void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) {
134134
defaultContext.updateScreenArea(event.getGui().width, event.getGui().height);
135135
if (checkGui(event.getGui())) {
136136
currentScreen.onResize(event.getGui().width, event.getGui().height);
@@ -140,14 +140,14 @@ public static void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) {
140140

141141
// before JEI
142142
@SubscribeEvent(priority = EventPriority.HIGH)
143-
public static void onGuiInputHigh(GuiScreenEvent.KeyboardInputEvent.Pre event) throws IOException {
143+
public void onGuiInputHigh(GuiScreenEvent.KeyboardInputEvent.Pre event) throws IOException {
144144
defaultContext.updateEventState();
145145
inputEvent(event, InputPhase.EARLY);
146146
}
147147

148148
// after JEI
149149
@SubscribeEvent(priority = EventPriority.LOW)
150-
public static void onGuiInputLow(GuiScreenEvent.KeyboardInputEvent.Pre event) throws IOException {
150+
public void onGuiInputLow(GuiScreenEvent.KeyboardInputEvent.Pre event) throws IOException {
151151
inputEvent(event, InputPhase.LATE);
152152
}
153153

@@ -160,7 +160,7 @@ private static void inputEvent(GuiScreenEvent.KeyboardInputEvent.Pre event, Inpu
160160

161161
// before JEI
162162
@SubscribeEvent(priority = EventPriority.HIGH)
163-
public static void onGuiInputHigh(GuiScreenEvent.MouseInputEvent.Pre event) throws IOException {
163+
public void onGuiInputHigh(GuiScreenEvent.MouseInputEvent.Pre event) throws IOException {
164164
defaultContext.updateEventState();
165165
if (checkGui(event.getGui())) currentScreen.getContext().updateEventState();
166166
if (handleMouseInput(Mouse.getEventButton(), currentScreen, event.getGui())) {
@@ -180,7 +180,7 @@ public static void onGuiInputHigh(GuiScreenEvent.MouseInputEvent.Pre event) thro
180180
}
181181

182182
@SubscribeEvent(priority = EventPriority.LOW)
183-
public static void onGuiDraw(GuiScreenEvent.DrawScreenEvent.Pre event) {
183+
public void onGuiDraw(GuiScreenEvent.DrawScreenEvent.Pre event) {
184184
int mx = event.getMouseX(), my = event.getMouseY();
185185
float pt = event.getRenderPartialTicks();
186186
defaultContext.updateState(mx, my, pt);
@@ -200,7 +200,7 @@ public static void onGuiDraw(GuiScreenEvent.DrawScreenEvent.Post event) {
200200
}
201201

202202
@SubscribeEvent
203-
public static void onTick(TickEvent.ClientTickEvent event) {
203+
public void onTick(TickEvent.ClientTickEvent event) {
204204
if (event.phase == TickEvent.Phase.END) {
205205
OverlayStack.onTick();
206206
defaultContext.tick();
@@ -212,7 +212,7 @@ public static void onTick(TickEvent.ClientTickEvent event) {
212212
}
213213

214214
@SubscribeEvent
215-
public static void preDraw(TickEvent.RenderTickEvent event) {
215+
public void preDraw(TickEvent.RenderTickEvent event) {
216216
if (event.phase == TickEvent.Phase.START) {
217217
GL11.glEnable(GL11.GL_STENCIL_TEST);
218218
}
@@ -446,7 +446,7 @@ public static void drawContainer(ModularScreen muiScreen, GuiContainer mcScreen,
446446
MinecraftForge.EVENT_BUS.post(new GuiContainerEvent.DrawForeground(mcScreen, mouseX, mouseY));
447447
GlStateManager.popMatrix();
448448

449-
InventoryPlayer inventoryplayer = Minecraft.getMinecraft().player.inventory;
449+
InventoryPlayer inventoryplayer = Platform.getClientPlayer().inventory;
450450
ItemStack itemstack = acc.getDraggedStack().isEmpty() ? inventoryplayer.getItemStack() : acc.getDraggedStack();
451451
GlStateManager.translate((float) x, (float) y, 0.0F);
452452
if (!itemstack.isEmpty()) {

src/main/java/com/cleanroommc/modularui/test/EventHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void draw(GuiContext context, int x, int y, int width, int height, Widget
3131
}.asIcon().height(3);
3232

3333
@SubscribeEvent
34-
public static void onItemUse(PlayerInteractEvent.RightClickItem event) {
34+
public void onItemUse(PlayerInteractEvent.RightClickItem event) {
3535
if (event.getEntityPlayer().getEntityWorld().isRemote && event.getItemStack().getItem() == Items.DIAMOND) {
3636
//GuiManager.openClientUI(Platform.getClientPlayer(), new TestGui());
3737
/*HoloUI.builder()
@@ -44,7 +44,7 @@ public static void onItemUse(PlayerInteractEvent.RightClickItem event) {
4444
}
4545

4646
@SubscribeEvent
47-
public static void onRichTooltip(RichTooltipEvent.Pre event) {
47+
public void onRichTooltip(RichTooltipEvent.Pre event) {
4848
if (enabledRichTooltipEventTest) {
4949
event.getTooltip()
5050
.add(IKey.str("Powered By: ").style(TextFormatting.GOLD, TextFormatting.ITALIC))

0 commit comments

Comments
 (0)