From 3e4aa9c757400007c04a5139c1b0707c66bd2923 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 29 Sep 2020 01:43:27 +0200 Subject: [PATCH] Check if structures can generate in the structure finder Closes #144 --- .../de/ellpeck/naturesaura/items/ItemStructureFinder.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemStructureFinder.java b/src/main/java/de/ellpeck/naturesaura/items/ItemStructureFinder.java index a17934cd..902f672c 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemStructureFinder.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemStructureFinder.java @@ -11,6 +11,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.structure.Structure; import net.minecraft.world.server.ServerWorld; +import net.minecraft.world.storage.ServerWorldInfo; public class ItemStructureFinder extends ItemImpl { private final Structure structureName; @@ -25,7 +26,8 @@ public class ItemStructureFinder extends ItemImpl { @Override public ActionResult onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); - if (!worldIn.isRemote) { + // ServerWorld.getStructureManager().doesGenerateFeatures() + if (!worldIn.isRemote && ((ServerWorld) worldIn).func_241112_a_().func_235005_a_()) { BlockPos pos = ((ServerWorld) worldIn).getChunkProvider().getChunkGenerator().func_235956_a_((ServerWorld) worldIn, this.structureName, playerIn.getPosition(), 1024, false); if (pos != null) { EntityStructureFinder entity = new EntityStructureFinder(ModEntities.STRUCTURE_FINDER, worldIn);