Skip to content

Commit

Permalink
Add new (non-functional) button to edit world screen
Browse files Browse the repository at this point in the history
  • Loading branch information
MacaylaMarvelous81 committed Aug 2, 2024
1 parent c81a0ab commit 730be96
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package ml.unbreakinggold.datapackinstaller.mixin;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.world.EditWorldScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.DirectionalLayoutWidget;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(EditWorldScreen.class)
public class EditWorldScreenMixin extends Screen {
@Shadow @Final private DirectionalLayoutWidget layout;
@Unique private static final Text SELECT_DATAPACKS_TEXT = Text.translatable("selectWorld.edit.datapacks");

protected EditWorldScreenMixin(Text title) {
super(title);
}

@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/EmptyWidget;<init>(II)V"), method = "<init>")
private void addButton(CallbackInfo info) {
this.layout.add(ButtonWidget.builder(SELECT_DATAPACKS_TEXT, (button) -> {}).width(200).build());
}
}
3 changes: 2 additions & 1 deletion src/main/resources/DatapackInstaller.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"mixins": [
],
"client": [
"CreateWorldScreenMixin"
"CreateWorldScreenMixin",
"EditWorldScreenMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/assets/datapackinstaller/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"selectWorld.edit.datapacks": "Select Datapacks"
}

0 comments on commit 730be96

Please sign in to comment.