Posted May 2, 20205 yr Hello fellow modders. So I have been trying to spawn particular fossils in my dimension. I was successful with this however I have received a weird issue where any time that it generates on a chunk border, it will cut off any part of the structure that's outside of that chunk. Obviously this is a pretty major issue, and I'm not sure whether this is a forge bug(I think it is) or whether somehow my placement code is wrong. While I was searching around for it, a friend of mine made this issue on the forge issue tracker: https://github.com/MinecraftForge/MinecraftForge/issues/6654. However this got closed by Lex and then the bot said to come here. Here is my feature class: Spoiler package com.turtywurty.tutorialmod.world.feature; import java.util.Random; import java.util.function.Function; import com.mojang.datafixers.Dynamic; import net.minecraft.util.Mirror; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.MutableBoundingBox; import net.minecraft.world.IWorld; import net.minecraft.world.gen.ChunkGenerator; import net.minecraft.world.gen.GenerationSettings; import net.minecraft.world.gen.Heightmap; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.NoFeatureConfig; import net.minecraft.world.gen.feature.template.BlockIgnoreStructureProcessor; import net.minecraft.world.gen.feature.template.IntegrityProcessor; import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.world.gen.feature.template.Template; import net.minecraft.world.server.ServerWorld; public class ExampleFeature extends Feature<NoFeatureConfig> { private static final ResourceLocation STRUCTURE_SPINE_01 = new ResourceLocation("fossil/spine_1"); private static final ResourceLocation STRUCTURE_SPINE_02 = new ResourceLocation("fossil/spine_2"); private static final ResourceLocation STRUCTURE_SPINE_03 = new ResourceLocation("fossil/spine_3"); private static final ResourceLocation STRUCTURE_SPINE_04 = new ResourceLocation("fossil/spine_4"); private static final ResourceLocation[] FOSSILS = new ResourceLocation[] { STRUCTURE_SPINE_01, STRUCTURE_SPINE_02, STRUCTURE_SPINE_03, STRUCTURE_SPINE_04 }; public ExampleFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> config) { super(config); } public boolean place(IWorld worldIn, ChunkGenerator<? extends GenerationSettings> generator, Random rand, BlockPos pos, NoFeatureConfig config) { Random random = worldIn.getRandom(); Rotation rotation = Rotation.values()[random.nextInt(Rotation.values().length)]; Template template = ((ServerWorld) worldIn.getWorld()).getSaveHandler().getStructureTemplateManager() .getTemplateDefaulted(FOSSILS[random.nextInt(FOSSILS.length)]); ChunkPos chunkpos = new ChunkPos(pos); PlacementSettings placementsettings = (new PlacementSettings()).setRotation(rotation) .setBoundingBox(new MutableBoundingBox(chunkpos.getXStart(), 0, chunkpos.getZStart(), chunkpos.getXEnd(), 256, chunkpos.getZEnd())) .setRandom(random).addProcessor(BlockIgnoreStructureProcessor.AIR_AND_STRUCTURE_BLOCK); BlockPos blockpos = template.transformedSize(rotation); int j = random.nextInt(16 - blockpos.getX()); int k = random.nextInt(16 - blockpos.getZ()); int l = 256; for (int i1 = 0; i1 < blockpos.getX(); ++i1) { for (int j1 = 0; j1 < blockpos.getZ(); ++j1) { l = Math.min(l, worldIn.getHeight(Heightmap.Type.WORLD_SURFACE, pos.getX() + i1 + j, pos.getZ() + j1 + k)); } } BlockPos blockpos1 = template.getZeroPositionWithTransform( new BlockPos(pos.add(j, 0, 0).getX(), l, pos.add(0, 0, k).getZ()), Mirror.NONE, rotation); IntegrityProcessor integrityprocessor = new IntegrityProcessor(0.9F); placementsettings.clearProcessors().addProcessor(integrityprocessor); template.addBlocksToWorld(worldIn, blockpos1, placementsettings, 4); placementsettings.func_215220_b(integrityprocessor); return true; } } Here is the method I use to add it: Spoiler package com.turtywurty.tutorialmod.init; import com.turtywurty.tutorialmod.world.feature.ExampleFeature; import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.GenerationStage; import net.minecraft.world.gen.feature.IFeatureConfig; import net.minecraft.world.gen.feature.NoFeatureConfig; import net.minecraft.world.gen.placement.ChanceConfig; import net.minecraft.world.gen.placement.Placement; public class ModBiomeFeatures { public static void addExampleFeature(Biome biome, int chance) { biome.addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, new ExampleFeature(NoFeatureConfig::deserialize).withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG) .withPlacement(Placement.CHANCE_HEIGHTMAP_DOUBLE.configure(new ChanceConfig(chance)))); } } And then I call this in my biome's constructor like so ModBiomeFeatures.addExampleFeature(this, 10); So if anyone knows a fix to this, I would love to know, as it does basically make structures useless xD. It only seems to want to let me upload 1 screenshot so here: Edited May 3, 20205 yr by TurtyWurty Fixed Weird Formatting Issue
July 22, 20205 yr @TurtyWurty--Did you ever figure out how to resolve this issue? I'm having the same problem right now with a custom feature of my own, and I haven't figured much out.
July 22, 20205 yr My guess with the somewhat limited information provided would be that the structure (NOT the feature) needs to be added to any biomes that may border on the custom biome. Adding the structure will allow it to be built there, but not adding the feature will cause it to not begin generating there.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.