|
7 | 7 | import CoflCore.events.OnModChatMessage; |
8 | 8 | import CoflCore.events.OnWriteToChatReceive; |
9 | 9 | import com.coflnet.gui.RenderUtils; |
| 10 | +import com.coflnet.gui.cofl.CoflBinGUI; |
| 11 | +import com.coflnet.gui.tfm.TfmBinGUI; |
10 | 12 | import com.mojang.brigadier.arguments.StringArgumentType; |
11 | 13 | import net.fabricmc.api.ClientModInitializer; |
12 | 14 | import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; |
|
15 | 17 | import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; |
16 | 18 | import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; |
17 | 19 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; |
| 20 | +import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents; |
18 | 21 | import net.fabricmc.loader.api.FabricLoader; |
19 | 22 | import net.minecraft.client.MinecraftClient; |
| 23 | +import net.minecraft.client.gui.screen.ingame.GenericContainerScreen; |
20 | 24 | import net.minecraft.client.option.KeyBinding; |
21 | 25 | import net.minecraft.client.util.InputUtil; |
| 26 | +import net.minecraft.item.Items; |
22 | 27 | import net.minecraft.text.Text; |
23 | 28 | import org.greenrobot.eventbus.Subscribe; |
24 | 29 | import org.lwjgl.glfw.GLFW; |
@@ -70,6 +75,26 @@ public void onInitializeClient() { |
70 | 75 | }))); |
71 | 76 | }); |
72 | 77 |
|
| 78 | + ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> { |
| 79 | + if (screen instanceof GenericContainerScreen gcs) { |
| 80 | + ScreenEvents.beforeRender(gcs).register((screen1, drawContext, mouseX, mouseY, tickDelta) -> { |
| 81 | + GenericContainerScreen gcs1 = (GenericContainerScreen) screen1; |
| 82 | + if (CoflCore.config.purchaseOverlay != null |
| 83 | + && gcs.getTitle().getLiteralString().contains("BIN Auction View") |
| 84 | + && gcs.getScreenHandler().getInventory().size() == 9 * 6) { |
| 85 | + if (!(client.currentScreen instanceof CoflBinGUI || client.currentScreen instanceof TfmBinGUI)) { |
| 86 | + switch (CoflCore.config.purchaseOverlay) { |
| 87 | + case COFL: client.setScreen(new CoflBinGUI(Items.BREAD, gcs1.getScreenHandler()));break; |
| 88 | + case TFM: client.setScreen(new TfmBinGUI(Items.BREAD));break; |
| 89 | + case null: default: break; |
| 90 | + } |
| 91 | + System.out.println("Empty?: " + gcs.getScreenHandler().getInventory().isEmpty()); |
| 92 | + } |
| 93 | + } |
| 94 | + }); |
| 95 | + } |
| 96 | + }); |
| 97 | + |
73 | 98 | } |
74 | 99 |
|
75 | 100 | @Subscribe |
|
0 commit comments