Fix server crash #betaBuild

This commit is contained in:
modmuss50 2019-08-08 14:27:21 +01:00
parent 861e79a398
commit e0fb6042d8

View file

@ -24,6 +24,8 @@
package techreborn.items; package techreborn.items;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -49,9 +51,13 @@ public class ItemManual extends Item {
public TypedActionResult<ItemStack> use(final World world, final PlayerEntity player, public TypedActionResult<ItemStack> use(final World world, final PlayerEntity player,
final Hand hand) { final Hand hand) {
if(world.isClient){ if(world.isClient){
MinecraftClient.getInstance().openScreen(new GuiManual(player)); openGui(player);
} }
return new TypedActionResult<>(ActionResult.SUCCESS, player.getStackInHand(hand)); return new TypedActionResult<>(ActionResult.SUCCESS, player.getStackInHand(hand));
} }
@Environment(EnvType.CLIENT)
private void openGui(PlayerEntity playerEntity){
MinecraftClient.getInstance().openScreen(new GuiManual(playerEntity));
}
} }