-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more things (and ability to import from world creation screen)
- Loading branch information
1 parent
5620db0
commit 4fd6b66
Showing
9 changed files
with
158 additions
and
69 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
14 changes: 14 additions & 0 deletions
14
common/src/main/java/dev/boxadactle/mcshare/mixin/CreateWorldParentAccessor.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,14 @@ | ||
package dev.boxadactle.mcshare.mixin; | ||
|
||
import net.minecraft.client.gui.screens.Screen; | ||
import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(CreateWorldScreen.class) | ||
public interface CreateWorldParentAccessor { | ||
|
||
@Accessor("lastScreen") | ||
Screen getParent(); | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
common/src/main/java/dev/boxadactle/mcshare/mixin/CreateWorldScreenMixin.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,37 @@ | ||
package dev.boxadactle.mcshare.mixin; | ||
|
||
import dev.boxadactle.mcshare.MCShare; | ||
import net.minecraft.client.gui.components.tabs.Tab; | ||
import net.minecraft.client.gui.screens.Screen; | ||
import net.minecraft.network.chat.Component; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
|
||
import java.util.Arrays; | ||
|
||
@Mixin(net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.class) | ||
public abstract class CreateWorldScreenMixin extends Screen { | ||
|
||
protected CreateWorldScreenMixin(Component component) { | ||
super(component); | ||
} | ||
|
||
// some IDEs will show this return value as an error | ||
@ModifyArg( | ||
method = "init", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/client/gui/components/tabs/TabNavigationBar$Builder;addTabs([Lnet/minecraft/client/gui/components/tabs/Tab;)Lnet/minecraft/client/gui/components/tabs/TabNavigationBar$Builder;", | ||
ordinal = 0 | ||
) | ||
) | ||
private Tab[] addImportTab(Tab[] args) { | ||
Tab[] cloned = Arrays.copyOf(args, args.length + 1); | ||
|
||
cloned[cloned.length - 1] = new MCShare.ImportTab(this); | ||
|
||
return cloned; | ||
} | ||
|
||
} |
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