idk
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package de.winniepat.parrotmod.mixin;
|
||||
|
||||
import de.winniepat.parrotmod.ui.SettingsScreen;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.Button; // Updated import
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import net.minecraft.network.chat.Component; // Replaces Text
|
||||
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(TitleScreen.class)
|
||||
public class TitleScreenMixin extends Screen {
|
||||
|
||||
protected TitleScreenMixin(Component title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "init")
|
||||
private void addCustomButton(CallbackInfo ci) {
|
||||
int x = this.width / 2 - 100;
|
||||
int y = this.height / 4 + 120;
|
||||
|
||||
this.addRenderableWidget(Button.builder(Component.literal("Parrot Mod"), (button) -> {
|
||||
Minecraft.getInstance().setScreen(new SettingsScreen(Component.literal("Settings")));
|
||||
}).bounds(x, y, 200, 20).build());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package de.winniepat.parrotmod.ui;
|
||||
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
public class SettingsScreen extends Screen {
|
||||
private int tabWidth = 100;
|
||||
private int currentTab = 0;
|
||||
|
||||
public SettingsScreen(Component title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
this.addRenderableWidget(Button.builder(Component.literal("General"), (b) -> {
|
||||
this.currentTab = 0;
|
||||
this.rebuildWidgets();;
|
||||
}).bounds(10, 65, tabWidth, 20).build());
|
||||
|
||||
this.addRenderableWidget(Button.builder(Component.literal("Graphics"), (b) -> {
|
||||
this.currentTab = 1;
|
||||
this.rebuildWidgets();
|
||||
}).bounds(10, 65, tabWidth, 20).build());
|
||||
|
||||
if (currentTab == 0) {
|
||||
this.addRenderableWidget(Button.builder(Component.literal("Enable Mod"), (b) -> {
|
||||
System.out.println("Enable Mod clicked");
|
||||
}).bounds(tabWidth + 30, 40, 150, 20).build());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user