Fix nether portal crash (#70)

This commit is contained in:
IzzelAliz 2020-10-31 10:49:12 +08:00
parent fa9ec260ac
commit ef8723e283
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,24 @@
package io.izzel.arclight.common.mixin.core.command.impl;
import com.mojang.brigadier.context.CommandContext;
import net.minecraft.command.CommandSource;
import net.minecraft.command.impl.GameRuleCommand;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.GameRules;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(GameRuleCommand.class)
public class GameRuleCommandMixin {
@Redirect(method = "func_223485_b", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;getGameRules()Lnet/minecraft/world/GameRules;"))
private static GameRules arclight$perWorldGameRule(MinecraftServer minecraftServer, CommandContext<CommandSource> context) {
return context.getSource().getWorld().getGameRules();
}
@Redirect(method = "func_223486_b", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;getGameRules()Lnet/minecraft/world/GameRules;"))
private static GameRules arclight$perWorldGameRule2(MinecraftServer minecraftServer, CommandSource source) {
return source.getWorld().getGameRules();
}
}

View File

@ -112,6 +112,7 @@
"command.arguments.EntitySelectorMixin",
"command.arguments.EntitySelectorParserMixin",
"command.impl.EffectCommandMixin",
"command.impl.GameRuleCommandMixin",
"command.impl.ReloadCommandMixin",
"command.impl.TeleportCommandMixin",
"command.impl.TimeCommandMixin",