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.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ArmorStandEntity; import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.item.ItemFrameEntity; import net.minecraft.entity.item.ItemFrameEntity;
@ -41,8 +40,8 @@ public class SchematicWorld extends WrappedWorld {
public BlockPos anchor; public BlockPos anchor;
public boolean renderMode; public boolean renderMode;
public SchematicWorld() { public SchematicWorld(World original) {
this(BlockPos.ZERO, Minecraft.getInstance().world); this(BlockPos.ZERO, original);
} }
public SchematicWorld(BlockPos anchor, World 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.Mirror;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; 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.PlacementSettings;
import net.minecraft.world.gen.feature.template.Template; import net.minecraft.world.gen.feature.template.Template;
@ -120,9 +121,10 @@ public class SchematicHandler {
if (size.equals(BlockPos.ZERO)) if (size.equals(BlockPos.ZERO))
return; return;
SchematicWorld w = new SchematicWorld(); World clientWorld = Minecraft.getInstance().world;
SchematicWorld wMirroredFB = new SchematicWorld(); SchematicWorld w = new SchematicWorld(clientWorld);
SchematicWorld wMirroredLR = new SchematicWorld(); SchematicWorld wMirroredFB = new SchematicWorld(clientWorld);
SchematicWorld wMirroredLR = new SchematicWorld(clientWorld);
PlacementSettings placementSettings = new PlacementSettings(); PlacementSettings placementSettings = new PlacementSettings();
schematic.addBlocksToWorld(w, BlockPos.ZERO, placementSettings); schematic.addBlocksToWorld(w, BlockPos.ZERO, placementSettings);