|
1
|
|
|
package de.pewpewproject.lasertag.mixin.gui; |
|
2
|
|
|
|
|
3
|
|
|
import net.minecraft.client.gui.screen.Screen; |
|
4
|
|
|
import net.minecraft.client.gui.screen.world.CreateWorldScreen; |
|
5
|
|
|
import net.minecraft.client.gui.screen.world.MoreOptionsDialog; |
|
6
|
|
|
import net.minecraft.client.resource.language.I18n; |
|
7
|
|
|
import net.minecraft.resource.DataPackSettings; |
|
8
|
|
|
import net.minecraft.world.Difficulty; |
|
9
|
|
|
import org.spongepowered.asm.mixin.Mixin; |
|
10
|
|
|
import org.spongepowered.asm.mixin.injection.At; |
|
11
|
|
|
import org.spongepowered.asm.mixin.injection.Inject; |
|
12
|
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Mixin into the CreateWorldScreen.class to set the cheats enabled by default. |
|
16
|
|
|
* |
|
17
|
|
|
* @author Étienne Muser |
|
18
|
|
|
*/ |
|
19
|
|
|
@Mixin(CreateWorldScreen.class) |
|
20
|
|
|
public abstract class CreateWorldScreenMixin { |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Overwrites the create world default values. |
|
24
|
|
|
* Sets cheats enabled to true, new world name to "New Arena World" and difficulty to peaceful. |
|
25
|
|
|
*/ |
|
26
|
|
|
@Inject(method = "<init>(Lnet/minecraft/client/gui/screen/Screen;Lnet/minecraft/resource/DataPackSettings;Lnet/minecraft/client/gui/screen/world/MoreOptionsDialog;)V", at = @At("TAIL")) |
|
27
|
|
|
private void setArenaDefaults(Screen parent, DataPackSettings dataPackSettings, MoreOptionsDialog moreOptionsDialog, CallbackInfo ci) { |
|
28
|
|
|
|
|
29
|
|
|
// Get this create world screen |
|
30
|
|
|
var createWorldScreen = ((CreateWorldScreen)(Object)this); |
|
31
|
|
|
|
|
32
|
|
|
// Overwrite the default values |
|
33
|
|
|
createWorldScreen.cheatsEnabled = true; |
|
34
|
|
|
createWorldScreen.tweakedCheats = true; |
|
35
|
|
|
createWorldScreen.levelName = I18n.translate("selectWorld.newArena"); |
|
36
|
|
|
createWorldScreen.currentDifficulty = Difficulty.PEACEFUL; |
|
37
|
|
|
} |
|
38
|
|
|
} |
|
39
|
|
|
|