Jump to content

[1.14.4/1.15.2] [Solved] Custom Biome/Structure/Feature Help


killerjdog51

Recommended Posts

So I've successfully created my biome and have it spawn. The issue is that the biome is too large. But whatever value I set the scale variable to the biome never grows smaller (I even tried setting a negative number and the results were horrifying). The other issue is my biome spawns on the outskirts of deserts rather than the insides. I'm thinking of making my idea into a feature that spawns randomly in deserts instead, but is there any way to make a feature linked to a specific biome? I'd like to hear some feedback/sugesstions on this.

 

goal:

- Small mini feature/biome that spawns within deserts

- 20 to 60 blocks in diameter

- small to medium lake (depending on diameter) in center with grass blocks and vegetation surrounding it (palm trees, melons, flowers, etc)

- vegetation to be a vibrant green similar to what is found in jungles

 

code:

public class OasisBiome extends Biome {

	public OasisBiome() {
	      super((new Biome.Builder()).surfaceBuilder(SurfaceBuilder.DEFAULT, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG).precipitation(Biome.RainType.NONE).category(Biome.Category.DESERT).depth(-0.1F).scale(0.00F).temperature(0.95F).downfall(0.9F).waterColor(4159204).waterFogColor(329011).parent("desert"));

	      this.addStructure(Feature.MINESHAFT, new MineshaftConfig(0.004D, MineshaftStructure.Type.NORMAL));
	      this.addStructure(Feature.STRONGHOLD, IFeatureConfig.NO_FEATURE_CONFIG);
	      this.addStructure(Feature.VILLAGE, new VillageConfig("village/desert/town_centers", 6));
	      this.addFeature(GenerationStage.Decoration.LOCAL_MODIFICATIONS, Biome.createDecoratedFeature(Feature.LAKE, new LakesConfig(Blocks.WATER.getDefaultState()), Placement.WATER_LAKE, new LakeChanceConfig(4)));
	      this.addFeature(Decoration.VEGETAL_DECORATION, Biome.createDecoratedFeature(WorldFeatures.PALM_TREE, IFeatureConfig.NO_FEATURE_CONFIG, Placement.COUNT_EXTRA_HEIGHTMAP, new AtSurfaceWithExtraConfig(1, 0.1F, 1)));
	      DefaultBiomeFeatures.addCarvers(this);
	      DefaultBiomeFeatures.addMonsterRooms(this);
	      DefaultBiomeFeatures.addStoneVariants(this);
	      DefaultBiomeFeatures.addOres(this);
	      DefaultBiomeFeatures.addSedimentDisks(this);
	      DefaultBiomeFeatures.addDefaultFlowers(this);
	      DefaultBiomeFeatures.func_222348_W(this);
	      DefaultBiomeFeatures.addExtraReedsPumpkinsCactus(this);
	      DefaultBiomeFeatures.addSprings(this);
	      DefaultBiomeFeatures.addDesertFeatures(this);
	      this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.RABBIT, 4, 2, 3));
	      this.addSpawn(EntityClassification.AMBIENT, new Biome.SpawnListEntry(EntityType.BAT, 10, 8, 8));
	      this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.SPIDER, 100, 4, 4));
	      this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.SKELETON, 100, 4, 4));
	      this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.ZOMBIE, 19, 4, 4));
	      this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.ZOMBIE_VILLAGER, 1, 1, 1));
	      
	      
	}

}

 

public class WorldGeneration {

	public static Biome OASIS = new OasisBiome();
	
	public static void registerBiome(Biome biome, int weight, BiomeType type, Type... types)
	{
		BiomeDictionary.addTypes(biome, types);
		BiomeManager.addBiome(type, new BiomeEntry(biome, weight));
		BiomeManager.addSpawnBiome(biome);
		BiomeProvider.BIOMES_TO_SPAWN_IN.add(biome);
	}
}

 

public static final DeferredRegister<Biome> BIOMES = new DeferredRegister<>(ForgeRegistries.BIOMES, Main.MOD_ID);
public static void setup()
	{
		BIOMES.register(FMLJavaModLoadingContext.get().getModEventBus());
  
      	WorldGeneration.registerBiome(WorldGeneration.OASIS, 5, BiomeType.DESERT, Type.DRY);

	}
  		public static final RegistryObject<Biome> OASIS_BIOME = BIOMES.register("oasis",  () -> WorldGeneration.OASIS);
}

 

Edited by killerjdog51
Link to comment
Share on other sites

I'm not sure, but I heard that, since, like, minecraft 1.8 biome spawning respects temperature and humidity. So now taiga can't be spawned next to a desert, etc. You may try to set humidity less than in desert and a temperature higher than in it, so minecraft will be allowed to spawn a biome only in a center of big desert.

But I can't figure out, how would you achieve a guaranteed single lake generation in a biome, so I'd choose to create a feature.

Everything said above may be absolutely wrong. No rights reserved.

Link to comment
Share on other sites

6 hours ago, Dzuchun said:

I'm not sure, but I heard that, since, like, minecraft 1.8 biome spawning respects temperature and humidity. So now taiga can't be spawned next to a desert, etc. You may try to set humidity less than in desert and a temperature higher than in it, so minecraft will be allowed to spawn a biome only in a center of big desert.

But I can't figure out, how would you achieve a guaranteed single lake generation in a biome, so I'd choose to create a feature.

Is it possible to create another feature from a feature? Because I'd like palm trees and flowers to spawn around the lake/oasis. 

Link to comment
Share on other sites

31 minutes ago, killerjdog51 said:

Is it possible to create another feature from a feature?

Wut? You mean, extend it? Generate another feature near randomly generated? Here is a class of my test structure:
 

public class TestStructure extends ScatteredStructure<NoFeatureConfig>{

    private static final int seedModifier = 2521523;
    private static final Random random = new Random(seedModifier);
    
    public TestStructure(Function<Dynamic<?>, ? extends NoFeatureConfig> configFactoryIn) {
        super(configFactoryIn);
    }

    @Override
    protected int getSeedModifier() {
        return seedModifier;
    }

    @Override
    public IStartFactory getStartFactory() {
        // TODO Auto-generated method stub
        return TestStructure.Start::new;
    }

    @Override
    public String getStructureName() {
        // TODO Auto-generated method stub
        return TestMod.TEST_STRUCTURE_PIECE_LOCATION.toString();
    }

    @Override
    public int getSize() {
        return 1;
    }
    
    public class Start extends StructureStart {

        public Start(Structure<?> structIn, int int_1, int int_2, MutableBoundingBox mutableBB, int int_3, long long_1) {
            super(structIn, int_1, int_2, mutableBB, int_3, long_1);
        }

        @Override
        public void init(ChunkGenerator<?> generator, TemplateManager templateManagerIn, int chunkX, int chunkZ, Biome biomeIn) {
            int worldX = chunkX * 16;
            int worldZ = chunkZ * 16;
            BlockPos blockpos = new BlockPos(worldX + random.nextInt(15), 0, worldZ + random.nextInt(15));
            this.components.add(new TestStructurePiece(templateManagerIn, TestMod.TEST_STRUCTURE_PIECE_LOCATION, blockpos, Rotation.randomRotation(random), 1));
            this.recalculateStructureSize();
        }
        
    }
}

(TestStructurePiece is a separate class, extending TemplateStructurePiece)

Take a look at init(....) method of Start subclass. I suspect, structure may consist of multiple pieces, that can be additionaly configured, rotated and placed. Here is TestStructurePiece class:
 

public class TestStructurePiece extends TemplateStructurePiece {

    public TestStructurePiece(TemplateManager templateMng, CompoundNBT nbt) {
        super(TestMod.TEST_STRUCTURE_PIECE, nbt);
        this.setupTemplate(templateMng);
    }

    public TestStructurePiece(TemplateManager templateMgr, ResourceLocation resLoc, BlockPos blockPos, Rotation rot, int offsetY) {
        super(TestMod.TEST_STRUCTURE_PIECE, 0);
        this.templatePosition = new BlockPos(blockPos.getX(), blockPos.getY() - offsetY, blockPos.getZ());
        this.setupTemplate(templateMgr);
    }

    private void setupTemplate(TemplateManager templateMgr) {
        Template template = templateMgr.getTemplateDefaulted(TestMod.TEST_STRUCTURE_PIECE_LOCATION);
        PlacementSettings placementsettings = (new PlacementSettings())
                .setRotation(Rotation.NONE)
                .setMirror(Mirror.NONE)
                .setCenterOffset(BlockPos.ZERO)
                .addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK);
        this.setup(template, this.templatePosition, placementsettings);
    }

    @Override
    public boolean func_225577_a_(IWorld worldIn, ChunkGenerator<?> chunkGenIn, Random rand,
            MutableBoundingBox mutableBB, ChunkPos chunkPos) {
        PlacementSettings placementsettings = (new PlacementSettings()).setRotation(Rotation.NONE)
                .setMirror(Mirror.NONE).setCenterOffset(BlockPos.ZERO)
                .addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK);
        BlockPos blockpos1 = this.templatePosition
                .add(Template.transformedBlockPos(placementsettings, new BlockPos(3, 0, 0)));
        int strucHeight = worldIn.getHeight(Heightmap.Type.WORLD_SURFACE_WG, blockpos1.getX(), blockpos1.getZ());
        this.templatePosition = this.templatePosition.add(0, strucHeight, 0);
        boolean superReturn = super.func_225577_a_(worldIn, chunkGenIn, rand, mutableBB, chunkPos);
        return superReturn;
    }

    @Override
    protected void handleDataMarker(String function, BlockPos pos, IWorld worldIn, Random rand,
            MutableBoundingBox sbb) {
        // No need

    }

}

Of course, I mostly copied it from some guide, and I don't really remember where from...

Yeah, TestMod.TEST_STRUCTURE_PIECE declaration:

TEST_STRUCTURE_PIECE = Registry.register(Registry.STRUCTURE_PIECE, TEST_STRUCTURE_PIECE_LOCATION,
                TestStructurePiece::new);

And "..._LOCATION" is a RecourceLocation of structure file (.nbt one)

Everything said above may be absolutely wrong. No rights reserved.

Link to comment
Share on other sites

Would it be necessary to create a structure? I'll certainly look into how structure generation works, however my goal is to simply create a lake in the desert with vegetation (grass, flowers, and trees) spawning around it on the grass. 

Here's what I have so far, I generate a lake of water with dirt and grass surrounding it and then I set the chunk's biome to my custom Oasis biome. I was hoping that by doing that my tree features would just generate, but unfortunately that's not the case. At least it causes the Grass to be green though, which was the main point of the biome. 

 

package killerjdog51.biomeEnhancementsMod.world.gen.feature;

import java.util.Random;
import java.util.Set;
import java.util.function.Function;

import com.mojang.datafixers.Dynamic;

import killerjdog51.biomeEnhancementsMod.init.WorldGeneration;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material;
import net.minecraft.tags.BlockTags;
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.LightType;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.GenerationSettings;
import net.minecraft.world.gen.IWorldGenerationReader;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.NoFeatureConfig;

public class OasisFeature extends Feature<NoFeatureConfig> {

	private static final BlockState AIR = Blocks.AIR.getDefaultState();
	private static final BlockState WATER = Blocks.WATER.getDefaultState();
  	private static final BlockState GRASS = Blocks.GRASS_BLOCK.getDefaultState();
  	private static final BlockState DIRT = Blocks.Dirt.getDefaultState();
  	private Static final BlockState SAND = Blocks.Sand.getDefaultState();
  
	private int size; 

	public OasisFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> configFactoryIn)
	{
		super(configFactoryIn);
	}

	@Override
	public boolean place(IWorld worldIn, ChunkGenerator<? extends GenerationSettings> generator, Random rand, BlockPos pos, NoFeatureConfig config) {
		
		int x = pos.getX();
		int z = pos.getZ();
		size = 1 + rand.nextInt(3);
		
		while(pos.getY() > 65 && worldIn.isAirBlock(pos))
		{
	         pos = pos.down();
	      }
		
		while(!(worldIn.getLightFor(LightType.SKY, pos) > 0))
		{
			pos = pos.up();
		}
		
	      if (pos.getY() <= 65)
	      {
	         return false;
	      } else {
	    	  
	    	  ChunkPos chunkpos = new ChunkPos(pos);
	          if (!worldIn.getChunk(chunkpos.x, chunkpos.z, ChunkStatus.STRUCTURE_REFERENCES).getStructureReferences(Feature.VILLAGE.getStructureName()).isEmpty()) {
	             return false;
	          }
	          
	    	  for (int xPos = -(11*size); xPos <= (12*size); ++xPos)
		       {
		           for (int zPos = -(11*size); zPos <= (12*size); ++zPos)
		           {
		        	   for (int yPos = -(8*size); yPos <0; ++yPos)
		        	   {
			               if (xPos * xPos + zPos * zPos >= (11*(size*size)) && !worldIn.getBlockState(pos.add(xPos, yPos, zPos)).isSolid())
			               {
			                   return false;
			               }
		        	   }
		           }
		       }	  
		     Layer(worldIn, pos, (11*size), SAND);
	         Layer(worldIn, pos, (10*size), GRASS);
	         for (int depth = 1; depth <= (4*size); depth++)
	         {
	        	 Layer(worldIn, pos.down(depth), (10*size), DIRT);
	         }
	         for (int depth = 0; depth < (3*size); depth++)
	         {
	        	 Layer(worldIn, pos.down(depth), ((8-depth)*size), WATER);
	         }
	         for (int air = 1; air <= 4; air++)
	         {
	        	 Layer(worldIn, pos.up(air), (10*size), AIR);
	         }
	         	            
	            return true;
	         }
	      
	}
	
	private void Layer(IWorld worldIn, BlockPos layerCenter, int width, BlockState state)
	   {
	       int max = width * width;

	       for (int x = -width; x <= width; ++x)
	       {
	           for (int z = -width; z <= width; ++z)
	           {
	               if (x * x + z * z <= max)
	               {
	                   BlockPos blockpos = layerCenter.add(x, 0, z);
						worldIn.setBlockState(blockpos, state, 2);
				        worldIn.getChunk(blockpos).getBiomes()[(blockpos.getX() & 15) << 4 | (blockpos.getZ() & 15)] = WorldGeneration.OASIS;
	               }
	           }
	       }
	   }
}

 

public class WorldFeatures {

	public static AbstractTreeFeature<NoFeatureConfig> PALM_TREE = new PalmTreeFeature(NoFeatureConfig::deserialize);
	public static Feature<NoFeatureConfig> OASIS = new OasisFeature(NoFeatureConfig::deserialize);


}

 

I want to trigger the palm tree feature to generate after I've created the lake portion. 

Link to comment
Share on other sites

17 hours ago, Dzuchun said:

Wut? You mean, extend it? Generate another feature near randomly generated? Here is a class of my test structure:

 

Upon further research I believe you have the right Idea. I don't know how exactly it will work yet, But I'll try combining the two features that I mentioned above (the Oasis and Palm Tree) into a structure that will randomly generate. Then the lake could perhaps be a little random instead of the cookie-cutter shape I currently have. Like randomly choose a x amount of central positions within the structure for where to spawn the oasis feature. And then choose a series of random positions that have grass underneath for where to spawn the palm tree feature. I don't know if this will work, But I believe it is the best step forward for creating a unique and naturally looking Oasis. 

Link to comment
Share on other sites

@Override 
public void init(ChunkGenerator<?> generator, TemplateManager templateManagerIn, int chunkX, int chunkZ, Biome biomeIn) {
  int worldX = chunkX * 16;
  int worldZ = chunkZ * 16;
  BlockPos blockpos = new BlockPos(worldX + random.nextInt(15), 0, worldZ + random.nextInt(15));
  this.components.add(new TestStructurePiece(templateManagerIn, TestMod.TEST_STRUCTURE_PIECE_LOCATION, blockpos, Rotation.randomRotation(random), 1)); this.recalculateStructureSize();
}

Actually, here you have a absolute freedom of how will you generate structure. You may even call single block a structure piece and actually generate your structure block-by-block (please, don't do that, I'm sure, this can be done in more intelligent way).

Everything said above may be absolutely wrong. No rights reserved.

Link to comment
Share on other sites

On 7/16/2020 at 9:33 AM, Dzuchun said:

@Override 
public void init(ChunkGenerator<?> generator, TemplateManager templateManagerIn, int chunkX, int chunkZ, Biome biomeIn) {
  int worldX = chunkX * 16;
  int worldZ = chunkZ * 16;
  BlockPos blockpos = new BlockPos(worldX + random.nextInt(15), 0, worldZ + random.nextInt(15));
  this.components.add(new TestStructurePiece(templateManagerIn, TestMod.TEST_STRUCTURE_PIECE_LOCATION, blockpos, Rotation.randomRotation(random), 1)); this.recalculateStructureSize();
}

Actually, here you have a absolute freedom of how will you generate structure. You may even call single block a structure piece and actually generate your structure block-by-block (please, don't do that, I'm sure, this can be done in more intelligent way).

I have no intention of placing individual blocks. However I am unfamiliar with structures, I've been looking at the different structures within Minecraft as well as the Scattered Structure and Structure classes, It would be useful to know what exactly getSeedModifier and getSize represent/do? Like does getSize return the amount of chunks the structure is allowed to spawn in? or is it just a relative size amount and not actually calculated? I understand how to build the structure, its just these two functions that I'd like to know the reason for including. Also, does the structure automatically spawn on the top surface block or do I need to calculate where to spawn similar to finding the Y value in my feature class? Perhaps all of this is trivial, but I'd like to have a basic understanding before beginning (especially since my structure will have varying sizes based on how many pools of water it spawns). And why would I need an nbt resource location, what is that used for in the generation of structures? I just want to fully understand what I'm getting into since I haven't been able to find structure tutorials for 1.14. 

Link to comment
Share on other sites

On 7/16/2020 at 9:33 AM, Dzuchun said:

Actually, here you have a absolute freedom of how will you generate structure. You may even call single block a structure piece and actually generate your structure block-by-block (please, don't do that, I'm sure, this can be done in more intelligent way).

 

Is this on the right track of how to generate a structure? It doesn't seem to be spawning in the game. 

public class OasisStructure extends ScatteredStructure<NoFeatureConfig>
{

	 private static final int seedModifier = 2521523;
	 private static final Random random = new Random(seedModifier);
	    
	public OasisStructure(Function<Dynamic<?>, ? extends NoFeatureConfig> config)
	{
		super(config);
	}

	@Override
	public String getStructureName()
	{
		return "Oasis";
	}

	@Override
	public int getSize()
	{
		return 1;
	}

	 protected int getDistance()
	 {
		return 20;
	 }

	 protected int getSeparation()
	 {
		return 11;
	 }
		  
		  
	@Override
	protected int getSeedModifier()
	{
		return seedModifier;
	}

	@Override
	protected ChunkPos getStartPositionForPosition(ChunkGenerator<?> chunkGenerator, Random random, int x, int z, int spacingOffsetsX, int spacingOffsetsZ)
	{
	    random.setSeed(this.getSeedModifier());
	    int distance = this.getDistance();
	    int separation = this.getSeparation();
	    int x1 = x + distance * spacingOffsetsX;
	    int z1 = z + distance * spacingOffsetsZ;
	    int x2 = x1 < 0 ? x1 - distance + 1 : x1;
	    int z2 = z1 < 0 ? z1 - distance + 1 : z1;
	    int x3 = x2 / distance;
	    int z3 = z2 / distance;
	    ((SharedSeedRandom) random).setLargeFeatureSeedWithSalt(chunkGenerator.getSeed(), x3, z3, this.getSeedModifier());
	    x3 = x3 * distance;
	    z3 = z3 * distance;
	    x3 = x3 + random.nextInt(distance - separation);
	    z3 = z3 + random.nextInt(distance - separation);

	    return new ChunkPos(x3, z3);
	  }

	 
	private static int getYPosForStructure(int chunkX, int chunkZ, ChunkGenerator<?> generatorIn)
	{
	      Random random = new Random((long)(chunkX + chunkZ * 10387313));
	      Rotation rotation = Rotation.values()[random.nextInt(Rotation.values().length)];
	      int x = 5;
	      int z = 5;
	      if (rotation == Rotation.CLOCKWISE_90) {
	         x = -5;
	      } else if (rotation == Rotation.CLOCKWISE_180) {
	         x = -5;
	         z = -5;
	      } else if (rotation == Rotation.COUNTERCLOCKWISE_90) {
	         z = -5;
	      }

	      int xPos = (chunkX << 4) + 7;
	      int zPos = (chunkZ << 4) + 7;
	      int pos1 = generatorIn.func_222531_c(xPos, zPos, Heightmap.Type.WORLD_SURFACE_WG);
	      int pos2 = generatorIn.func_222531_c(xPos, zPos + z, Heightmap.Type.WORLD_SURFACE_WG);
	      int pos3 = generatorIn.func_222531_c(xPos + x, zPos, Heightmap.Type.WORLD_SURFACE_WG);
	      int pos4 = generatorIn.func_222531_c(xPos + x, zPos + z, Heightmap.Type.WORLD_SURFACE_WG);
	      return Math.min(Math.min(pos1, pos2), Math.min(pos3, pos4));
	   }
	
	@Override
	public IStartFactory getStartFactory()
	{
		return OasisStructure.Start::new;
	}
	
	 public static class Start extends StructureStart
	 {
	      public Start(Structure<?> structure, int chunkX, int chunkZ, Biome biome, MutableBoundingBox structureBoundingBox, int reference, long seed) {
	         super(structure, chunkX, chunkZ, biome, structureBoundingBox, reference, seed);
	      }

	      public void init(ChunkGenerator<?> generator, TemplateManager templateManagerIn, int chunkX, int chunkZ, Biome biomeIn)
	      {
	    	  
	    	  int worldX = chunkX * 16;
	    	  int worldZ = chunkZ * 16;
	    	  int worldY = OasisStructure.getYPosForStructure(chunkX, chunkZ, generator);
	    	  
	    	  BlockPos blockpos = new BlockPos(worldX + random.nextInt(15), worldY, worldZ + random.nextInt(15));
	    	  OasisStructurePiece oasispiece = new OasisStructurePiece(random, blockpos, 1);
	    	  this.components.add(oasispiece);
	         this.recalculateStructureSize();
	      }
	   }
	
}

 

public class OasisStructurePiece extends ScatteredStructurePiece {

	protected OasisStructurePiece(Random rand, BlockPos pos, int size) {
		super(StructurePieceRegistry.OASIS_PIECE, rand, pos.getX(), pos.getY(), pos.getZ(), (11*size), -(5*size), (11*size));
	}

	protected OasisStructurePiece(TemplateManager template, CompoundNBT nbt)
	{
		super(StructurePieceRegistry.OASIS_PIECE, nbt);
	}
	@Override
	public boolean addComponentParts(IWorld worldIn, Random randomIn, MutableBoundingBox structureBoundingBoxIn, ChunkPos p_74875_4_)
	{
		 this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 10, 1, 10, Blocks.GRASS_BLOCK.getDefaultState(), Blocks.WATER.getDefaultState(), false);
		 this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 10, 1, 10, Blocks.DIRT.getDefaultState(), Blocks.WATER.getDefaultState(), false);
		 this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 9, 1, 9, Blocks.DIRT.getDefaultState(), Blocks.WATER.getDefaultState(), false);
		 this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 8, 1, 8, Blocks.DIRT.getDefaultState(), Blocks.WATER.getDefaultState(), false);
		 this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 7, 1, 7, Blocks.DIRT.getDefaultState(), Blocks.WATER.getDefaultState(), false);

         
		return true;
	}

}

 

public class WorldFeatures {

	public static AbstractTreeFeature<NoFeatureConfig> PALM_TREE = new PalmTreeFeature(NoFeatureConfig::deserialize);
	public static Structure<NoFeatureConfig> OASIS = new OasisStructure(NoFeatureConfig::deserialize);


}

 

public class StructureRegistry {

	
    public static final Structure<?> OASIS = register("oasis", WorldFeatures.OASIS);

    
    private static Structure<?> register(String key, Structure<?> type) {
        return Registry.register(Registry.STRUCTURE_FEATURE, new ResourceLocation(Main.MOD_ID, key), type);
    }

}

 

public class StructurePieceRegistry {

    public static final IStructurePieceType OASIS_PIECE = register("oasis", OasisStructurePiece::new);

    private static IStructurePieceType register(String key, IStructurePieceType type) {
        return Registry.register(Registry.STRUCTURE_PIECE, new ResourceLocation(Main.MOD_ID, key), type);
    }

}

 

public class WorldGeneration {

	public static Biome OASIS = new OasisBiome();
	
	public static void registerBiome(Biome biome, int weight, BiomeType type, Type... types)
	{
		BiomeDictionary.addTypes(biome, types);
		BiomeManager.addBiome(type, new BiomeEntry(biome, weight));
		BiomeManager.addSpawnBiome(biome);
		//BiomeProvider.BIOMES_TO_SPAWN_IN.add(biome);
	}
	
	public static void init()
	{
	
		Biomes.BEACH.addFeature(
                Decoration.VEGETAL_DECORATION,
                Biome.createDecoratedFeature(
                        WorldFeatures.PALM_TREE,
                        IFeatureConfig.NO_FEATURE_CONFIG,
                        Placement.COUNT_EXTRA_HEIGHTMAP,
                        new AtSurfaceWithExtraConfig(0, 0.06F, 1))
        );
			
		Biomes.DESERT.addStructure(WorldFeatures.OASIS, IFeatureConfig.NO_FEATURE_CONFIG);
		
		/**
		Biomes.DESERT.addFeature(
                Decoration.LOCAL_MODIFICATIONS,
                Biome.createDecoratedFeature(
                        WorldFeatures.OASIS,
                        IFeatureConfig.NO_FEATURE_CONFIG,
                        Placement.WATER_LAKE,
                        new LakeChanceConfig(1))
        );
		**/
		
	}
}

 

 

I'm sorry, I'm not familiar with how any of this stuff works. 

Link to comment
Share on other sites

Thought I'd give an update. I got my idea working, but through somewhat unconventional means. I tried getting the structure to work with no avail. Perhaps in the future I'll revisit how structures work  when I have a more uniform structure (like the witch hut, desert pyramid, or jungle temple; something that'll always spawn the same way), but for this I decided to stick with the oasis being a feature. Spawning is pretty much the same, the only difference is that I placed my custom sapling and then forced it to grow into a tree. I also randomly placed reeds, grass, and flowers around the lake. Then I had the function recursively call itself to try placing a second oasis within like 5 blocks or so away from the center of the already generated one. This allows my feature to appear somewhat random in shape and size. I don't know if what I did was the best way, but I think it works out quite well and blends somewhat naturally in the Minecraft environment. I think it's also simpler to understand and get working compared to structures. If I figure out a way to allow my feature to work as a structure though I may consider switching to that though. 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.