From 0e9aad6763b7acf40b1436118f6264d21f7a0f9c Mon Sep 17 00:00:00 2001 From: tterrag Date: Thu, 11 Jun 2020 21:53:03 -0400 Subject: [PATCH] Fix dedicated server crash when using schematicannon printing Closes #355 --- .../create/content/schematics/SchematicWorld.java | 5 ++--- .../content/schematics/client/SchematicHandler.java | 8 +++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java index 442e7ba6c..0cb77977b 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java @@ -13,7 +13,6 @@ import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.item.ArmorStandEntity; import net.minecraft.entity.item.ItemFrameEntity; @@ -41,8 +40,8 @@ public class SchematicWorld extends WrappedWorld { public BlockPos anchor; public boolean renderMode; - public SchematicWorld() { - this(BlockPos.ZERO, Minecraft.getInstance().world); + public SchematicWorld(World original) { + this(BlockPos.ZERO, original); } public SchematicWorld(BlockPos anchor, World original) { diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicHandler.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicHandler.java index e15904751..632108933 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicHandler.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicHandler.java @@ -28,6 +28,7 @@ import net.minecraft.nbt.NBTUtil; import net.minecraft.util.Mirror; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.world.gen.feature.template.Template; @@ -120,9 +121,10 @@ public class SchematicHandler { if (size.equals(BlockPos.ZERO)) return; - SchematicWorld w = new SchematicWorld(); - SchematicWorld wMirroredFB = new SchematicWorld(); - SchematicWorld wMirroredLR = new SchematicWorld(); + World clientWorld = Minecraft.getInstance().world; + SchematicWorld w = new SchematicWorld(clientWorld); + SchematicWorld wMirroredFB = new SchematicWorld(clientWorld); + SchematicWorld wMirroredLR = new SchematicWorld(clientWorld); PlacementSettings placementSettings = new PlacementSettings(); schematic.addBlocksToWorld(w, BlockPos.ZERO, placementSettings);