-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rendering of the mine menu itself doesn´t work, but functionality 100% works. Sub screens to select options works just fine as well.
- Loading branch information
1 parent
fa82e90
commit a8da86f
Showing
8 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
package com.girafi.minemenu; | ||
|
||
import com.girafi.minemenu.data.menu.RadialMenu; | ||
import com.girafi.minemenu.gui.RadialMenuScreen; | ||
import com.girafi.minemenu.handler.KeyboardHandlerHelper; | ||
import com.girafi.minemenu.util.Config; | ||
import fuzs.forgeconfigapiport.api.config.v3.ForgeConfigRegistry; | ||
import net.fabricmc.api.ModInitializer; | ||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; | ||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; | ||
import net.fabricmc.loader.api.FabricLoader; | ||
import net.neoforged.fml.config.ModConfig; | ||
|
||
public class MineMenu implements ModInitializer { | ||
|
||
@Override | ||
public void onInitialize() { | ||
MineMenuCommon.loadCommon(FabricLoader.getInstance().getGameDir().toFile()); | ||
|
||
MineMenuCommon.setupMenuLoader(); | ||
KeyBindingHelper.registerKeyBinding(MineMenuCommon.WHEEL); | ||
ForgeConfigRegistry.INSTANCE.register(Constants.MOD_ID, ModConfig.Type.COMMON, Config.spec); | ||
|
||
ClientTickEvents.END_CLIENT_TICK.register((mc) -> { | ||
RadialMenu.tickTimer(); | ||
|
||
if ((mc.level == null || mc.isPaused()) && RadialMenuScreen.active) { | ||
RadialMenuScreen.deactivate(); | ||
} | ||
|
||
KeyboardHandlerHelper.onClientTick(); | ||
}); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
fabric/src/main/java/com/girafi/minemenu/mixin/MixinGameRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.girafi.minemenu.mixin; | ||
|
||
import com.girafi.minemenu.gui.RadialMenuScreen; | ||
import com.girafi.minemenu.handler.ClientTickHelper; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.GuiGraphics; | ||
import net.minecraft.client.renderer.GameRenderer; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(GameRenderer.class) | ||
public class MixinGameRenderer { | ||
|
||
@Inject(at = @At("TAIL"), method = "render(FJZ)V") | ||
private void render(float f, long l, boolean b, CallbackInfo info) { | ||
GameRenderer gameRenderer = (GameRenderer) (Object) this; | ||
Minecraft mc = gameRenderer.getMinecraft(); | ||
|
||
if (mc.level != null && !mc.options.hideGui && !mc.isPaused() && RadialMenuScreen.active) { | ||
System.out.println("RENDER MINE MENU"); | ||
GuiGraphics guiGraphics = new GuiGraphics(mc, gameRenderer.renderBuffers.bufferSource()); | ||
ClientTickHelper.renderButtonBackgrounds(); | ||
ClientTickHelper.renderItems(guiGraphics); | ||
ClientTickHelper.renderText(guiGraphics); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters