Alright, I''m trying to spawn trees in my normal world. I already got the nbt files but i cant seem to fix how the "Feature" class works. (If i'm actually supposed to use that one) heres my code now
public class SilverwoodFeature extends Feature<NoFeatureConfig> {
public SilverwoodFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> configFactoryIn) {
super(configFactoryIn);
}
@Override
public boolean place(IWorld world, ChunkGenerator<? extends GenerationSettings> generator, Random random, BlockPos spawnPos, NoFeatureConfig config) {
ServerWorld worldserver = (ServerWorld) world;
TemplateManager templatemanager = worldserver.getStructureTemplateManager();
Template template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/greatwoodtree"));
int h = ThreadLocalRandom.current().nextInt(0, 7);
switch(h) {
case 1: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood1")); break;
case 2: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood2")); break;
case 3: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood3")); break;
case 4: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood4")); break;
case 5: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood5")); break;
case 6: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood6")); break;
case 7: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood7")); break;
}
if(random.nextInt(1) != 0 || world.getBiome(spawnPos) != Biomes.PLAINS) {
return false;
}
if(template == null) {
Constants.LOGGER.error("Could not find structure at " + new ResourceLocation("arcana:structures/trees/greatwood"));
return false;
}
PlacementSettings placementsettings = (new PlacementSettings()).setMirror(Mirror.NONE)
.setRotation(Rotation.NONE).setIgnoreEntities(false).setChunk(null);
template.addBlocksToWorld(world, spawnPos.add(-4, 0, -4), placementsettings);
return true;
}