From 3be810a9ebd3f080a2d3892b5782e47082a310ac Mon Sep 17 00:00:00 2001 From: tterrag Date: Sat, 3 Oct 2020 16:27:09 -0400 Subject: [PATCH] Yet more porting, bodge to let SchematicWorld implement IServerWorld --- .../structureMovement/ContraptionRenderer.java | 2 +- .../content/schematics/SchematicWorld.java | 18 +++++++++++++++--- .../advancement/KineticBlockTrigger.java | 3 ++- .../create/foundation/gui/GuiGameElement.java | 2 +- .../utility/worldWrappers/WrappedWorld.java | 2 +- .../foundation/worldgen/AllWorldFeatures.java | 3 ++- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionRenderer.java index 62dcf37c3..3bc1b0b72 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionRenderer.java @@ -60,7 +60,7 @@ public class ContraptionRenderer { } private static SuperByteBuffer buildStructureBuffer(Contraption c) { - if (renderWorld == null || renderWorld.getWorld() != Minecraft.getInstance().world) + if (renderWorld == null || renderWorld.getWrappedWorld() != Minecraft.getInstance().world) renderWorld = new PlacementSimulationWorld(Minecraft.getInstance().world); MatrixStack ms = new MatrixStack(); 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 aae2396ad..41e597ddc 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java @@ -10,8 +10,8 @@ import java.util.function.Predicate; import java.util.stream.Stream; import com.simibubi.create.foundation.utility.BlockHelper; - import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -26,11 +26,16 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MutableBoundingBox; -import net.minecraft.world.*; +import net.minecraft.world.EmptyTickList; +import net.minecraft.world.IServerWorld; +import net.minecraft.world.ITickList; +import net.minecraft.world.LightType; +import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeRegistry; +import net.minecraft.world.server.ServerWorld; -public class SchematicWorld extends WrappedWorld { +public class SchematicWorld extends WrappedWorld implements IServerWorld { private Map blocks; private Map tileEntities; @@ -189,4 +194,11 @@ public class SchematicWorld extends WrappedWorld { return tileEntities.values(); } + @Override + public ServerWorld getWorld() { + if (this.world instanceof ServerWorld) { + return (ServerWorld) this.world; + } + throw new IllegalStateException("Cannot use IServerWorld#getWorld in a client environment"); + } } diff --git a/src/main/java/com/simibubi/create/foundation/advancement/KineticBlockTrigger.java b/src/main/java/com/simibubi/create/foundation/advancement/KineticBlockTrigger.java index f5a741f11..bf7ea17d6 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/KineticBlockTrigger.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/KineticBlockTrigger.java @@ -10,6 +10,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; import com.simibubi.create.Create; +import net.minecraft.advancements.criterion.EntityPredicate; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.ServerPlayerEntity; @@ -52,7 +53,7 @@ public class KineticBlockTrigger extends CriterionTriggerBase