-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new (non-functional) button to edit world screen
- Loading branch information
1 parent
c81a0ab
commit 730be96
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/main/java/ml/unbreakinggold/datapackinstaller/mixin/EditWorldScreenMixin.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 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()); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"selectWorld.edit.datapacks": "Select Datapacks" | ||
} |