Fix dedicated server crash when using schematicannon printing

Closes #355
This commit is contained in:
tterrag 2020-06-11 21:53:03 -04:00
parent dd4b3385f8
commit 0e9aad6763
2 changed files with 7 additions and 6 deletions

View File

@ -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) {

View File

@ -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);