Finished off worldgen (except trees)

This commit is contained in:
Adubbz 2019-06-25 13:48:39 +10:00
parent e98567ca4f
commit 0f435c7f93
30 changed files with 596 additions and 435 deletions

View file

@ -163,7 +163,7 @@ public class BiomeMapColours
public static int getBiomeBlockColourForCoords(Biome biome, BlockPos pos)
{
BlockState topBlock = biome.getSurfaceBuilder().getConfig().getTopMaterial();
BlockState topBlock = biome.getSurfaceBuilder().getConfig().getTop();
int colour;
if (topBlock == Blocks.GRASS.getDefaultState())

View file

@ -36,7 +36,11 @@ public class ColdDesertBiome extends BiomeBOP
{
public ColdDesertBiome()
{
<<<<<<< HEAD
super((new Biome.Builder()).surfaceBuilder(new ConfiguredSurfaceBuilder(BOPBiomeFeatures.COLD_DESERT_SURFACE_BUILDER, GRAVEL_SURFACE)).precipitation(Biome.RainType.NONE).category(Biome.Category.ICY).depth(0.0F).scale(0.0F).temperature(-0.25F).downfall(0.0F).waterColor(4159204).waterFogColor(329011).parent((String)null));
=======
super((new Biome.BiomeBuilder()).surfaceBuilder(new CompositeSurfaceBuilder(BOPBiomeFeatures.COLD_DESERT_SURFACE_BUILDER, GRAVEL_SURFACE)).precipitation(Biome.RainType.NONE).category(Biome.Category.ICY).depth(0.05F).scale(0.0F).temperature(0.2F).downfall(0.0F).waterColor(4159204).waterFogColor(329011).parent((String)null));
>>>>>>> 23ad4b22dd4f1d9f81ff5efa7bc6b9519d4d41af
// Mineshafts and Strongholds
this.addStructure(Feature.IGLOO, new IglooConfig());
@ -89,18 +93,20 @@ public class ColdDesertBiome extends BiomeBOP
this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.STRAY, 80, 4, 4));
this.addWeight(BOPClimates.ICE_CAP, 10);
this.setBeachBiome(Biomes.SNOWY_BEACH);
this.setRiverBiome(Biomes.FROZEN_RIVER);
this.setBeachBiome((Biome)null);
this.setRiverBiome((Biome)null);
this.canSpawnInBiome = false;
}
@OnlyIn(Dist.CLIENT)
@Override
public int getGrassColor(BlockPos pos)
{
return 0xAD9364;
}
@OnlyIn(Dist.CLIENT)
@Override
public int getFoliageColor(BlockPos pos)
{
return 0xB5A76C;

View file

@ -38,7 +38,7 @@ public class ItemMudball extends Item
{
EntityMudball mudball = new EntityMudball(world, player);
mudball.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
world.spawnEntity(mudball);
world.addEntity(mudball);
}
player.addStat(Stats.ITEM_USED.get(this));

View file

@ -11,6 +11,7 @@ import net.minecraft.fluid.IFluidState;
import net.minecraft.block.Blocks;
import net.minecraft.init.Fluids;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -24,7 +25,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
public class ItemWaterPlant extends ItemBlock
public class ItemWaterPlant extends BlockItem
{
private Block block;

View file

@ -9,15 +9,14 @@ package biomesoplenty.common.world;
import com.google.common.collect.Sets;
import net.minecraft.block.BlockState;
import net.minecraft.world.biome.Biomes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeCache;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.provider.BiomeProvider;
import net.minecraft.world.biome.provider.OverworldBiomeProviderSettings;
import net.minecraft.world.gen.OverworldGenSettings;
import net.minecraft.world.gen.feature.structure.Structure;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.Layer;
import net.minecraft.world.storage.WorldInfo;
import javax.annotation.Nullable;
@ -28,38 +27,36 @@ import java.util.Set;
public class BOPBiomeProvider extends BiomeProvider
{
private final BiomeCache cache = new BiomeCache(this);
private final GenLayer genBiomes;
private final Layer genBiomes;
/** A GenLayer containing a factory to generate biome arrays for {@llink #getBiomes(int, int, int, int, boolean)} */
private final GenLayer biomeFactoryLayer;
private final Layer biomeFactoryLayer;
private final Biome[] biomes = new Biome[]{Biomes.OCEAN, Biomes.PLAINS, Biomes.DESERT, Biomes.MOUNTAINS, Biomes.FOREST, Biomes.TAIGA, Biomes.SWAMP, Biomes.RIVER, Biomes.FROZEN_OCEAN, Biomes.FROZEN_RIVER, Biomes.SNOWY_TUNDRA, Biomes.SNOWY_MOUNTAINS, Biomes.MUSHROOM_FIELDS, Biomes.MUSHROOM_FIELD_SHORE, Biomes.BEACH, Biomes.DESERT_HILLS, Biomes.WOODED_HILLS, Biomes.TAIGA_HILLS, Biomes.MOUNTAIN_EDGE, Biomes.JUNGLE, Biomes.JUNGLE_HILLS, Biomes.JUNGLE_EDGE, Biomes.DEEP_OCEAN, Biomes.STONE_SHORE, Biomes.SNOWY_BEACH, Biomes.BIRCH_FOREST, Biomes.BIRCH_FOREST_HILLS, Biomes.DARK_FOREST, Biomes.SNOWY_TAIGA, Biomes.SNOWY_TAIGA_HILLS, Biomes.GIANT_TREE_TAIGA, Biomes.GIANT_TREE_TAIGA_HILLS, Biomes.WOODED_MOUNTAINS, Biomes.SAVANNA, Biomes.SAVANNA_PLATEAU, Biomes.BADLANDS, Biomes.WOODED_BADLANDS_PLATEAU, Biomes.BADLANDS_PLATEAU, Biomes.WARM_OCEAN, Biomes.LUKEWARM_OCEAN, Biomes.COLD_OCEAN, Biomes.DEEP_WARM_OCEAN, Biomes.DEEP_LUKEWARM_OCEAN, Biomes.DEEP_COLD_OCEAN, Biomes.DEEP_FROZEN_OCEAN, Biomes.SUNFLOWER_PLAINS, Biomes.DESERT_LAKES, Biomes.GRAVELLY_MOUNTAINS, Biomes.FLOWER_FOREST, Biomes.TAIGA_MOUNTAINS, Biomes.SWAMP_HILLS, Biomes.ICE_SPIKES, Biomes.MODIFIED_JUNGLE, Biomes.MODIFIED_JUNGLE_EDGE, Biomes.TALL_BIRCH_FOREST, Biomes.TALL_BIRCH_HILLS, Biomes.DARK_FOREST_HILLS, Biomes.SNOWY_TAIGA_MOUNTAINS, Biomes.GIANT_SPRUCE_TAIGA, Biomes.GIANT_SPRUCE_TAIGA_HILLS, Biomes.MODIFIED_GRAVELLY_MOUNTAINS, Biomes.SHATTERED_SAVANNA, Biomes.SHATTERED_SAVANNA_PLATEAU, Biomes.ERODED_BADLANDS, Biomes.MODIFIED_WOODED_BADLANDS_PLATEAU, Biomes.MODIFIED_BADLANDS_PLATEAU};
public BOPBiomeProvider(OverworldBiomeProviderSettings settingsProvider)
{
WorldInfo worldinfo = settingsProvider.getWorldInfo();
OverworldGenSettings settings = settingsProvider.getGeneratorSettings();
GenLayer[] agenlayer = BOPLayerUtil.createGenLayers(worldinfo.getSeed(), worldinfo.getGenerator(), settings);
Layer[] agenlayer = BOPLayerUtil.createGenLayers(worldinfo.getSeed(), worldinfo.getGenerator(), settings);
this.genBiomes = agenlayer[0];
this.biomeFactoryLayer = agenlayer[1];
}
@Override
@Nullable
public Biome getBiome(BlockPos pos, @Nullable Biome defaultBiome)
public Biome getBiome(int x, int y)
{
return this.cache.getBiome(pos.getX(), pos.getZ(), defaultBiome);
return this.biomeFactoryLayer.func_215738_a(x, y);
}
@Override
public Biome[] getBiomes(int startX, int startZ, int xSize, int zSize)
public Biome func_222366_b(int p_222366_1_, int p_222366_2_)
{
return this.genBiomes.generateBiomes(startX, startZ, xSize, zSize, Biomes.DEFAULT);
return this.genBiomes.func_215738_a(p_222366_1_, p_222366_2_);
}
@Override
public Biome[] getBiomes(int x, int z, int width, int length, boolean cacheFlag)
{
return cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0 ? this.cache.getCachedBiomes(x, z) : this.biomeFactoryLayer.generateBiomes(x, z, width, length, Biomes.DEFAULT);
return this.biomeFactoryLayer.generateBiomes(x, z, width, length);
}
@Override
@ -72,7 +69,7 @@ public class BOPBiomeProvider extends BiomeProvider
int i1 = k - i + 1;
int j1 = l - j + 1;
Set<Biome> set = Sets.<Biome>newHashSet();
Collections.addAll(set, this.genBiomes.generateBiomes(i, j, i1, j1, (Biome)null));
Collections.addAll(set, this.genBiomes.generateBiomes(i, j, i1, j1));
return set;
}
@ -86,7 +83,7 @@ public class BOPBiomeProvider extends BiomeProvider
int l = z + range >> 2;
int i1 = k - i + 1;
int j1 = l - j + 1;
Biome[] abiome = this.genBiomes.generateBiomes(i, j, i1, j1, (Biome)null);
Biome[] abiome = this.genBiomes.generateBiomes(i, j, i1, j1);
BlockPos blockpos = null;
int k1 = 0;
@ -135,10 +132,4 @@ public class BOPBiomeProvider extends BiomeProvider
return this.topBlocksCache;
}
@Override
public void tick()
{
this.cache.cleanupCache();
}
}

View file

@ -9,13 +9,12 @@ package biomesoplenty.common.world.gen.feature;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.world.gen.feature.tree.*;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.Blocks;
import net.minecraft.world.gen.feature.FlowersFeature;
import net.minecraft.block.LeavesBlock;
import net.minecraft.world.gen.feature.AbstractTreeFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.FlowersFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraft.world.gen.surfacebuilders.ISurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilderConfig;
@ -46,7 +45,7 @@ public class BOPBiomeFeatures
public static final AbstractTreeFeature<NoFeatureConfig> BIG_WHITE_CHERRY_TREE = new BigTreeFeature.Builder().log(BOPBlocks.cherry_log.getDefaultState()).leaves(BOPBlocks.white_cherry_leaves.getDefaultState()).create();
public static final AbstractTreeFeature<NoFeatureConfig> BIG_MAGIC_TREE = new BigTreeFeature.Builder().log(BOPBlocks.magic_log.getDefaultState()).leaves(BOPBlocks.magic_leaves.getDefaultState()).create();
public static final AbstractTreeFeature<NoFeatureConfig> GIANT_TREE = new BigTreeFeature.Builder().log(Blocks.DARK_OAK_LOG.getDefaultState()).leaves(Blocks.DARK_OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true)).minHeight(25).maxHeight(30).trunkWidth(4).create();
public static final AbstractTreeFeature<NoFeatureConfig> GIANT_TREE = new BigTreeFeature.Builder().log(Blocks.DARK_OAK_LOG.getDefaultState()).leaves(Blocks.DARK_OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true)).minHeight(25).maxHeight(30).trunkWidth(4).create();
//Conifer Trees
public static final AbstractTreeFeature<NoFeatureConfig> TALL_SPRUCE_TREE = new TaigaTreeFeature.Builder().log(Blocks.SPRUCE_LOG.getDefaultState()).leaves(Blocks.SPRUCE_LEAVES.getDefaultState()).maxHeight(13).create();
@ -108,48 +107,48 @@ public class BOPBiomeFeatures
/////////////////////////////////////////////////////////////////////////////////
//Features
public static final Feature<SplotchConfig> SPLOTCH = new SplotchFeature();
public static final Feature<NoFeatureConfig> BRAMBLE = new BrambleFeature();
public static final Feature<NoFeatureConfig> MANGROVE = new MangroveFeature();
public static final Feature<NoFeatureConfig> PUMPKIN_PATCH = new PumpkinPatchFeature();
public static final Feature<NoFeatureConfig> BIG_PUMPKIN = new BigPumpkinFeature();
public static final Feature<NoFeatureConfig> SCRUB = new ScrubFeature();
public static final Feature<NoFeatureConfig> HEATH = new HeathFeature();
public static final Feature<SplotchConfig> SPLOTCH = new SplotchFeature(SplotchConfig::deserialize);
public static final Feature<NoFeatureConfig> BRAMBLE = new BrambleFeature(NoFeatureConfig::deserialize);
public static final Feature<NoFeatureConfig> MANGROVE = new MangroveFeature(NoFeatureConfig::deserialize);
public static final Feature<NoFeatureConfig> PUMPKIN_PATCH = new PumpkinPatchFeature(NoFeatureConfig::deserialize);
public static final Feature<NoFeatureConfig> BIG_PUMPKIN = new BigPumpkinFeature(NoFeatureConfig::deserialize);
public static final Feature<NoFeatureConfig> SCRUB = new ScrubFeature(NoFeatureConfig::deserialize);
public static final Feature<NoFeatureConfig> HEATH = new HeathFeature(NoFeatureConfig::deserialize);
//Flowers
public static final FlowersFeature CHAPARRAL_FLOWERS = new ChaparralFlowersFeature();
public static final FlowersFeature CHERRY_BLOSSOM_GROVE_FLOWERS = new CherryBlossomGroveFlowersFeature();
public static final FlowersFeature EXTENDED_FLOWERS = new ExtendedFlowersFeature();
public static final FlowersFeature FLOWER_MEADOW_FLOWERS = new FlowerMeadowFlowersFeature();
public static final FlowersFeature JUNGLE_FLOWERS = new JungleFlowersFeature();
public static final FlowersFeature LAVENDER_FLOWERS = new LavenderFlowersFeature();
public static final FlowersFeature LUSH_GRASSLAND_FLOWERS = new LushGrasslandFlowersFeature();
public static final FlowersFeature LUSH_SWAMP_FLOWERS = new LushSwampFlowersFeature();
public static final FlowersFeature MEADOW_FLOWERS = new MeadowFlowersFeature();
public static final FlowersFeature MOOR_FLOWERS = new MoorFlowersFeature();
public static final FlowersFeature MYSTIC_GROVE_FLOWERS = new MysticGroveFlowersFeature();
public static final FlowersFeature ORIGIN_FLOWERS = new OriginFlowersFeature();
public static final FlowersFeature PRAIRIE_FLOWERS = new PrairieFlowersFeature();
public static final FlowersFeature RAINFOREST_FLOWERS = new RainforestFlowersFeature();
public static final FlowersFeature SHRUBLAND_FLOWERS = new ShrublandFlowersFeature();
public static final FlowersFeature SNOWY_FLOWERS = new SnowyFlowersFeature();
public static final FlowersFeature TROPICS_FLOWERS = new TropicsFlowersFeature();
public static final FlowersFeature WASTELAND_FLOWERS = new WastelandFlowersFeature();
public static final FlowersFeature WETLAND_FLOWERS = new WetlandFlowersFeature();
public static final FlowersFeature XERIC_SHRUBLAND_FLOWERS = new XericShrublandFlowersFeature();
public static final FlowersFeature CHAPARRAL_FLOWERS = new ChaparralFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature CHERRY_BLOSSOM_GROVE_FLOWERS = new CherryBlossomGroveFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature EXTENDED_FLOWERS = new ExtendedFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature FLOWER_MEADOW_FLOWERS = new FlowerMeadowFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature JUNGLE_FLOWERS = new JungleFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature LAVENDER_FLOWERS = new LavenderFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature LUSH_GRASSLAND_FLOWERS = new LushGrasslandFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature LUSH_SWAMP_FLOWERS = new LushSwampFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature MEADOW_FLOWERS = new MeadowFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature MOOR_FLOWERS = new MoorFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature MYSTIC_GROVE_FLOWERS = new MysticGroveFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature ORIGIN_FLOWERS = new OriginFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature PRAIRIE_FLOWERS = new PrairieFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature RAINFOREST_FLOWERS = new RainforestFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature SHRUBLAND_FLOWERS = new ShrublandFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature SNOWY_FLOWERS = new SnowyFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature TROPICS_FLOWERS = new TropicsFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature WASTELAND_FLOWERS = new WastelandFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature WETLAND_FLOWERS = new WetlandFlowersFeature(NoFeatureConfig::deserialize);
public static final FlowersFeature XERIC_SHRUBLAND_FLOWERS = new XericShrublandFlowersFeature(NoFeatureConfig::deserialize);
//Surfaces
public static final SurfaceBuilder<SurfaceBuilderConfig> BOG_SURFACE_BUILDER = new BogSurfaceBuilder();
public static final SurfaceBuilder<SurfaceBuilderConfig> BRUSHLAND_SURFACE_BUILDER = new BrushlandSurfaceBuilder();
public static final SurfaceBuilder<SurfaceBuilderConfig> CHAPARRAL_SURFACE_BUILDER = new ChaparralSurfaceBuilder();
public static final SurfaceBuilder<SurfaceBuilderConfig> COLD_DESERT_SURFACE_BUILDER = new ColdDesertSurfaceBuilder();
public static final SurfaceBuilder<SurfaceBuilderConfig> GRANITE_SURFACE_BUILDER = new GraniteSurfaceBuilder();
public static final SurfaceBuilder<SurfaceBuilderConfig> MARSH_SURFACE_BUILDER = new MarshSurfaceBuilder();
public static final SurfaceBuilder<SurfaceBuilderConfig> MANGROVE_SURFACE_BUILDER = new MangroveSurfaceBuilder();
public static final SurfaceBuilder<SurfaceBuilderConfig> MUD_SURFACE_BUILDER = new MudSurfaceBuilder();
public static final SurfaceBuilder<SurfaceBuilderConfig> PODZOL_SURFACE_BUILDER = new PodzolSurfaceBuilder();
public static final SurfaceBuilder<SurfaceBuilderConfig> VOLCANO_SURFACE_BUILDER = new VolcanoSurfaceBuilder();
public static final SurfaceBuilder<SurfaceBuilderConfig> VOLCANO_EDGE_SURFACE_BUILDER = new VolcanoEdgeSurfaceBuilder();
public static final SurfaceBuilder<SurfaceBuilderConfig> BOG_SURFACE_BUILDER = new BogSurfaceBuilder(SurfaceBuilderConfig::deserialize);
public static final SurfaceBuilder<SurfaceBuilderConfig> BRUSHLAND_SURFACE_BUILDER = new BrushlandSurfaceBuilder(SurfaceBuilderConfig::deserialize);
public static final SurfaceBuilder<SurfaceBuilderConfig> CHAPARRAL_SURFACE_BUILDER = new ChaparralSurfaceBuilder(SurfaceBuilderConfig::deserialize);
public static final SurfaceBuilder<SurfaceBuilderConfig> COLD_DESERT_SURFACE_BUILDER = new ColdDesertSurfaceBuilder(SurfaceBuilderConfig::deserialize);
public static final SurfaceBuilder<SurfaceBuilderConfig> GRANITE_SURFACE_BUILDER = new GraniteSurfaceBuilder(SurfaceBuilderConfig::deserialize);
public static final SurfaceBuilder<SurfaceBuilderConfig> MARSH_SURFACE_BUILDER = new MarshSurfaceBuilder(SurfaceBuilderConfig::deserialize);
public static final SurfaceBuilder<SurfaceBuilderConfig> MANGROVE_SURFACE_BUILDER = new MangroveSurfaceBuilder(SurfaceBuilderConfig::deserialize);
public static final SurfaceBuilder<SurfaceBuilderConfig> MUD_SURFACE_BUILDER = new MudSurfaceBuilder(SurfaceBuilderConfig::deserialize);
public static final SurfaceBuilder<SurfaceBuilderConfig> PODZOL_SURFACE_BUILDER = new PodzolSurfaceBuilder(SurfaceBuilderConfig::deserialize);
public static final SurfaceBuilder<SurfaceBuilderConfig> VOLCANO_SURFACE_BUILDER = new VolcanoSurfaceBuilder(SurfaceBuilderConfig::deserialize);
public static final SurfaceBuilder<SurfaceBuilderConfig> VOLCANO_EDGE_SURFACE_BUILDER = new VolcanoEdgeSurfaceBuilder(SurfaceBuilderConfig::deserialize);
public static final SurfaceBuilderConfig ASH_SURFACE = new SurfaceBuilderConfig(BOPBlocks.ash_block.getDefaultState(), BOPBlocks.ash_block.getDefaultState(), Blocks.GRAVEL.getDefaultState());
public static final SurfaceBuilderConfig GRANITE_SURFACE = new SurfaceBuilderConfig(Blocks.GRANITE.getDefaultState(), Blocks.GRANITE.getDefaultState(), Blocks.GRAVEL.getDefaultState());

View file

@ -1,120 +1,127 @@
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import biomesoplenty.common.util.block.IBlockPosQuery;
import net.minecraft.block.BlockLeaves;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.LeavesBlock;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.gen.IChunkGenSettings;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.GenerationSettings;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import java.util.Random;
import java.util.function.Function;
public class BigPumpkinFeature extends Feature<NoFeatureConfig>
{
protected IBlockPosQuery placeOn = (world, pos) -> world.getBlockState(pos).getBlock() == Blocks.GRASS_BLOCK;
protected IBlockPosQuery replace = (world, pos) -> world.getBlockState(pos).canBeReplacedByLeaves(world, pos);
@Override
public boolean place(IWorld world, IChunkGenerator<? extends IChunkGenSettings> p_212245_2_, Random p_212245_3_, BlockPos startPos, NoFeatureConfig p_212245_5_)
{
while (startPos.getY() > 1 && this.replace.matches(world, startPos)) {startPos = startPos.down();}
protected IBlockPosQuery placeOn = (world, pos) -> world.getBlockState(pos).getBlock() == Blocks.GRASS_BLOCK;
protected IBlockPosQuery replace = (world, pos) -> world.getBlockState(pos).canBeReplacedByLeaves(world, pos);
if (!this.placeOn.matches(world, startPos.add(2, 0, 2)))
{
// Abandon if we can't place the tree on this block
return false;
}
if (!this.checkSpace(world, startPos.up()))
{
// Abandon if there isn't enough room
return false;
}
BlockPos pos = startPos.up();
for (int x = 1; x < 4; x++)
{
for (int y = 0; y < 5; y++)
{
for (int z = 1; z < 4; z++)
{
this.setBlock(world, pos.add(x,y,z), Blocks.PUMPKIN.getDefaultState());
}
}
}
for (int x = 0; x < 5; x++)
{
for (int y = 1; y < 4; y++)
{
for (int z = 1; z < 4; z++)
{
this.setBlock(world, pos.add(x,y,z), Blocks.PUMPKIN.getDefaultState());
}
}
}
for (int x = 1; x < 4; x++)
{
for (int y = 1; y < 4; y++)
{
for (int z = 0; z < 5; z++)
{
this.setBlock(world, pos.add(x,y,z), Blocks.PUMPKIN.getDefaultState());
}
}
}
this.setBlock(world, pos.add(2,5,2), Blocks.OAK_LOG.getDefaultState());
this.setBlock(world, pos.add(1,5,2), Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true));
this.setBlock(world, pos.add(0,4,1), Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true));
this.setBlock(world, pos.add(2,5,3), Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true));
this.setBlock(world, pos.add(3,5,3), Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true));
this.setBlock(world, pos.add(2,4,4), Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true));
this.setBlock(world, pos.add(3,4,4), Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true));
this.setBlock(world, pos.add(3,5,1), Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true));
this.setBlock(world, pos.add(3,4,0), Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true));
this.setBlock(world, pos.add(4,4,2), Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true));
this.setBlock(world, pos.add(4,3,0), Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true));
this.setBlock(world, pos.add(4,2,0), Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true));
return true;
}
public boolean setBlock(IWorld world, BlockPos pos, BlockState state)
{
if (this.replace.matches(world, pos))
{
this.setBlockState(world, pos, state);
return true;
}
return false;
}
public boolean checkSpace(IWorld world, BlockPos pos)
{
for (int y = 0; y <= 6; y++)
{
for (int x = 0; x <= 5; x++)
{
for (int z = 0; z <= 5; z++)
{
BlockPos pos1 = pos.add(x, y, z);
if (pos1.getY() >= 255 || !this.replace.matches(world, pos1))
{
return false;
}
}
}
}
return true;
}
public BigPumpkinFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
@Override
public boolean place(IWorld world, ChunkGenerator<? extends GenerationSettings> p_212245_2_, Random p_212245_3_, BlockPos startPos, NoFeatureConfig p_212245_5_)
{
while (startPos.getY() > 1 && this.replace.matches(world, startPos)) {startPos = startPos.down();}
if (!this.placeOn.matches(world, startPos.add(2, 0, 2)))
{
// Abandon if we can't place the tree on this block
return false;
}
if (!this.checkSpace(world, startPos.up()))
{
// Abandon if there isn't enough room
return false;
}
BlockPos pos = startPos.up();
for (int x = 1; x < 4; x++)
{
for (int y = 0; y < 5; y++)
{
for (int z = 1; z < 4; z++)
{
this.setBlock(world, pos.add(x,y,z), Blocks.PUMPKIN.getDefaultState());
}
}
}
for (int x = 0; x < 5; x++)
{
for (int y = 1; y < 4; y++)
{
for (int z = 1; z < 4; z++)
{
this.setBlock(world, pos.add(x,y,z), Blocks.PUMPKIN.getDefaultState());
}
}
}
for (int x = 1; x < 4; x++)
{
for (int y = 1; y < 4; y++)
{
for (int z = 0; z < 5; z++)
{
this.setBlock(world, pos.add(x,y,z), Blocks.PUMPKIN.getDefaultState());
}
}
}
this.setBlock(world, pos.add(2,5,2), Blocks.OAK_LOG.getDefaultState());
this.setBlock(world, pos.add(1,5,2), Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true));
this.setBlock(world, pos.add(0,4,1), Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true));
this.setBlock(world, pos.add(2,5,3), Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true));
this.setBlock(world, pos.add(3,5,3), Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true));
this.setBlock(world, pos.add(2,4,4), Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true));
this.setBlock(world, pos.add(3,4,4), Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true));
this.setBlock(world, pos.add(3,5,1), Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true));
this.setBlock(world, pos.add(3,4,0), Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true));
this.setBlock(world, pos.add(4,4,2), Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true));
this.setBlock(world, pos.add(4,3,0), Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true));
this.setBlock(world, pos.add(4,2,0), Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true));
return true;
}
public boolean setBlock(IWorld world, BlockPos pos, BlockState state)
{
if (this.replace.matches(world, pos))
{
this.setBlockState(world, pos, state);
return true;
}
return false;
}
public boolean checkSpace(IWorld world, BlockPos pos)
{
for (int y = 0; y <= 6; y++)
{
for (int x = 0; x <= 5; x++)
{
for (int z = 0; z <= 5; z++)
{
BlockPos pos1 = pos.add(x, y, z);
if (pos1.getY() >= 255 || !this.replace.matches(world, pos1))
{
return false;
}
}
}
}
return true;
}
}

View file

@ -7,55 +7,63 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.gen.surfacebuilders.ISurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilderConfig;
public class BogSurfaceBuilder implements ISurfaceBuilder<SurfaceBuilderConfig>
import java.util.Random;
import java.util.function.Function;
public class BogSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderConfig>
{
public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config)
{
double d0 = Biome.INFO_NOISE.getValue((double)x * 0.25D, (double)z * 0.25D);
if (d0 > 0.1D)
{
int i = x & 15;
int j = z & 15;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
BlockPos.MutableBlockPos blockposdown$mutableblockpos = new BlockPos.MutableBlockPos();
BlockPos.MutableBlockPos blockposup$mutableblockpos = new BlockPos.MutableBlockPos();
public BogSurfaceBuilder(Function<Dynamic<?>, ? extends SurfaceBuilderConfig> deserializer)
{
super(deserializer);
}
for(int k = startHeight; k >= 0; --k)
{
blockpos$mutableblockpos.setPos(i, k, j);
if (!chunkIn.getBlockState(blockpos$mutableblockpos).isAir())
@Override
public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config)
{
double d0 = Biome.INFO_NOISE.getValue((double)x * 0.25D, (double)z * 0.25D);
if (d0 > 0.1D)
{
int i = x & 15;
int j = z & 15;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
BlockPos.MutableBlockPos blockposdown$mutableblockpos = new BlockPos.MutableBlockPos();
BlockPos.MutableBlockPos blockposup$mutableblockpos = new BlockPos.MutableBlockPos();
for(int k = startHeight; k >= 0; --k)
{
if (k == 62)
{
if (chunkIn.getBlockState(blockpos$mutableblockpos).getBlock() != defaultFluid.getBlock())
{
chunkIn.setBlockState(blockpos$mutableblockpos, defaultFluid, false);
}
else
{
blockposup$mutableblockpos.setPos(i, k+1, j);
blockposdown$mutableblockpos.setPos(i, k-1, j);
if (chunkIn.getBlockState(blockposdown$mutableblockpos).getBlock() != defaultFluid.getBlock())
{
chunkIn.setBlockState(blockpos$mutableblockpos, Blocks.GRASS_BLOCK.getDefaultState(), false);
}
}
}
break;
blockpos$mutableblockpos.setPos(i, k, j);
if (!chunkIn.getBlockState(blockpos$mutableblockpos).isAir())
{
if (k == 62)
{
if (chunkIn.getBlockState(blockpos$mutableblockpos).getBlock() != defaultFluid.getBlock())
{
chunkIn.setBlockState(blockpos$mutableblockpos, defaultFluid, false);
}
else
{
blockposup$mutableblockpos.setPos(i, k+1, j);
blockposdown$mutableblockpos.setPos(i, k-1, j);
if (chunkIn.getBlockState(blockposdown$mutableblockpos).getBlock() != defaultFluid.getBlock())
{
chunkIn.setBlockState(blockpos$mutableblockpos, Blocks.GRASS_BLOCK.getDefaultState(), false);
}
}
}
break;
}
}
}
}
}
Biome.DEFAULT_SURFACE_BUILDER.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, config);
}
SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, config);
}
}

View file

@ -7,37 +7,44 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.block.BlockBramble;
import biomesoplenty.common.util.biome.GeneratorUtil;
import biomesoplenty.common.util.block.IBlockPosQuery;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.material.Material;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.SaplingBlock;
import net.minecraft.block.material.Material;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.gen.IChunkGenSettings;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.GenerationSettings;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import java.util.Random;
import java.util.function.Function;
public class BrambleFeature extends Feature<NoFeatureConfig>
{
public BrambleFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
protected IBlockPosQuery placeOn = (world, pos) ->
{
BlockState state = world.getBlockState(pos);
return state.canSustainPlant(world, pos, Direction.UP, (BlockSapling)Blocks.OAK_SAPLING) || state.getBlock() == Blocks.SOUL_SAND;
return state.canSustainPlant(world, pos, Direction.UP, (SaplingBlock)Blocks.OAK_SAPLING) || state.getBlock() == Blocks.SOUL_SAND;
};
protected IBlockPosQuery replace = (world, pos) -> world.getBlockState(pos).getMaterial() == Material.AIR;
@Override
public boolean place(IWorld world, IChunkGenerator<? extends IChunkGenSettings> p_212245_2, Random rand, BlockPos startPos, NoFeatureConfig p_212245_5_)
public boolean place(IWorld world, ChunkGenerator<? extends GenerationSettings> p_212245_2, Random rand, BlockPos startPos, NoFeatureConfig p_212245_5_)
{
for (int i = 0; i < 128; ++i)
{
@ -74,7 +81,7 @@ public class BrambleFeature extends Feature<NoFeatureConfig>
BlockPos leafPos = genPos.offset(Direction.values()[leafDirection]);
if (world.isAirBlock(leafPos))
{
world.setBlockState(leafPos, Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true), 19);
world.setBlockState(leafPos, Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true), 19);
for (Direction face : Direction.values())
{
if (world.getBlockState(leafPos.offset(face)).getBlock() == BOPBlocks.bramble)

View file

@ -7,21 +7,33 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.gen.surfacebuilders.ISurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilderConfig;
public class BrushlandSurfaceBuilder implements ISurfaceBuilder<SurfaceBuilderConfig> {
public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config) {
if (noise > 1.9D) {
Biome.DEFAULT_SURFACE_BUILDER.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, Biome.SAND_SURFACE);
} else {
Biome.DEFAULT_SURFACE_BUILDER.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, Biome.GRASS_DIRT_GRAVEL_SURFACE);
}
import java.util.Random;
import java.util.function.Function;
}
}
public class BrushlandSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderConfig>
{
public BrushlandSurfaceBuilder(Function<Dynamic<?>, ? extends SurfaceBuilderConfig> deserializer)
{
super(deserializer);
}
@Override
public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config)
{
if (noise > 1.9D)
{
SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilder.SAND_CONFIG);
}
else
{
SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG);
}
}
}

View file

@ -7,25 +7,34 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import biomesoplenty.api.block.BOPBlocks;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.AbstractFlowersFeature;
import net.minecraft.world.gen.feature.FlowersFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
public class ChaparralFlowersFeature extends AbstractFlowersFeature
import java.util.Random;
import java.util.function.Function;
public class ChaparralFlowersFeature extends FlowersFeature
{
private static final Block[] FLOWERS = new Block[]{BOPBlocks.wildflower, Blocks.AZURE_BLUET, Blocks.DANDELION, Blocks.POPPY};
private static final Block[] FLOWERS = new Block[]{BOPBlocks.wildflower, Blocks.AZURE_BLUET, Blocks.DANDELION, Blocks.POPPY};
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)];
return block.getDefaultState();
}
}
public ChaparralFlowersFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
@Override
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)];
return block.getDefaultState();
}
}

View file

@ -7,21 +7,30 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.gen.surfacebuilders.ISurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilderConfig;
public class ChaparralSurfaceBuilder implements ISurfaceBuilder<SurfaceBuilderConfig> {
public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config) {
if (noise > 1.7D) {
Biome.DEFAULT_SURFACE_BUILDER.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, Biome.STONE_STONE_GRAVEL_SURFACE);
} else {
Biome.DEFAULT_SURFACE_BUILDER.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, Biome.GRASS_DIRT_GRAVEL_SURFACE);
}
import java.util.Random;
import java.util.function.Function;
}
}
public class ChaparralSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderConfig>
{
public ChaparralSurfaceBuilder(Function<Dynamic<?>, ? extends SurfaceBuilderConfig> deserializer)
{
super(deserializer);
}
@Override
public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config) {
if (noise > 1.7D) {
SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilder.STONE_STONE_GRAVEL_CONFIG);
} else {
SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG);
}
}
}

View file

@ -7,16 +7,25 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import biomesoplenty.api.block.BOPBlocks;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.gen.feature.AbstractFlowersFeature;
import net.minecraft.world.gen.feature.FlowersFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
public class CherryBlossomGroveFlowersFeature extends AbstractFlowersFeature
import java.util.Random;
import java.util.function.Function;
public class CherryBlossomGroveFlowersFeature extends FlowersFeature
{
public CherryBlossomGroveFlowersFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
@Override
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{
int j = p_202355_1_.nextInt(2);

View file

@ -7,25 +7,33 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.gen.surfacebuilders.ISurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilderConfig;
public class ColdDesertSurfaceBuilder implements ISurfaceBuilder<SurfaceBuilderConfig>
import java.util.Random;
import java.util.function.Function;
public class ColdDesertSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderConfig>
{
public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config)
{
if (noise > 2.6D)
{
Biome.DEFAULT_SURFACE_BUILDER.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, BOPBiomeFeatures.PACKED_ICE_SURFACE);
}
else
{
Biome.DEFAULT_SURFACE_BUILDER.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, Biome.GRAVEL_SURFACE);
}
}
public ColdDesertSurfaceBuilder(Function<Dynamic<?>, ? extends SurfaceBuilderConfig> deserializer)
{
super(deserializer);
}
@Override
public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config)
{
if (noise > 2.6D)
{
SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, BOPBiomeFeatures.SNOW_SNOW_GRAVEL_SURFACE);
}
else
{
SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilder.GRAVEL_CONFIG);
}
}
}

View file

@ -7,15 +7,24 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.gen.feature.AbstractFlowersFeature;
import net.minecraft.world.gen.feature.FlowersFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
public class ExtendedFlowersFeature extends AbstractFlowersFeature
import java.util.Random;
import java.util.function.Function;
public class ExtendedFlowersFeature extends FlowersFeature
{
public ExtendedFlowersFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
@Override
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{
int j = p_202355_1_.nextInt(3);

View file

@ -7,47 +7,54 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.gen.IChunkGenSettings;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.GenerationSettings;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import java.util.Random;
import java.util.function.Function;
public class FernGrassFeature extends Feature<NoFeatureConfig>
{
public BlockState chooseGrassState(Random rand)
{
return rand.nextInt(3) == 0 ? Blocks.FERN.getDefaultState() : Blocks.GRASS.getDefaultState();
}
public FernGrassFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
@Override
public boolean place(IWorld world, IChunkGenerator<? extends IChunkGenSettings> generator, Random rand, BlockPos pos, NoFeatureConfig config)
{
BlockState BlockState = this.chooseGrassState(rand);
public BlockState chooseGrassState(Random rand)
{
return rand.nextInt(3) == 0 ? Blocks.FERN.getDefaultState() : Blocks.GRASS.getDefaultState();
}
for (BlockState BlockState1 = world.getBlockState(pos); (BlockState1.isAir(world, pos) || BlockState1.isIn(BlockTags.LEAVES)) && pos.getY() > 0; BlockState1 = world.getBlockState(pos))
{
pos = pos.down();
}
@Override
public boolean place(IWorld world, ChunkGenerator<? extends GenerationSettings> generator, Random rand, BlockPos pos, NoFeatureConfig config)
{
BlockState BlockState = this.chooseGrassState(rand);
int i = 0;
for (BlockState BlockState1 = world.getBlockState(pos); (BlockState1.isAir(world, pos) || BlockState1.isIn(BlockTags.LEAVES)) && pos.getY() > 0; BlockState1 = world.getBlockState(pos))
{
pos = pos.down();
}
for (int j = 0; j < 128; ++j)
{
BlockPos blockpos = pos.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
if (world.isAirBlock(blockpos) && BlockState.isValidPosition(world, blockpos))
{
world.setBlockState(blockpos, BlockState, 2);
++i;
}
}
int i = 0;
return i > 0;
}
}
for (int j = 0; j < 128; ++j)
{
BlockPos blockpos = pos.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
if (world.isAirBlock(blockpos) && BlockState.isValidPosition(world, blockpos))
{
world.setBlockState(blockpos, BlockState, 2);
++i;
}
}
return i > 0;
}
}

View file

@ -7,24 +7,33 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.AbstractFlowersFeature;
import net.minecraft.world.gen.feature.FlowersFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
public class FlowerMeadowFlowersFeature extends AbstractFlowersFeature
import java.util.Random;
import java.util.function.Function;
public class FlowerMeadowFlowersFeature extends FlowersFeature
{
private static final Block[] FLOWERS = new Block[]{Blocks.ORANGE_TULIP, Blocks.WHITE_TULIP, Blocks.PINK_TULIP, Blocks.RED_TULIP};
private static final Block[] FLOWERS = new Block[]{Blocks.ORANGE_TULIP, Blocks.WHITE_TULIP, Blocks.PINK_TULIP, Blocks.RED_TULIP};
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)];
return block.getDefaultState();
}
public FlowerMeadowFlowersFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
@Override
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)];
return block.getDefaultState();
}
}

View file

@ -7,21 +7,30 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.gen.surfacebuilders.ISurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilderConfig;
public class GraniteSurfaceBuilder implements ISurfaceBuilder<SurfaceBuilderConfig> {
public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config) {
if (noise > 1.9D) {
Biome.DEFAULT_SURFACE_BUILDER.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, BOPBiomeFeatures.GRANITE_SURFACE);
} else {
Biome.DEFAULT_SURFACE_BUILDER.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, Biome.GRASS_DIRT_GRAVEL_SURFACE);
}
import java.util.Random;
import java.util.function.Function;
}
}
public class GraniteSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderConfig>
{
public GraniteSurfaceBuilder(Function<Dynamic<?>, ? extends SurfaceBuilderConfig> deserializer)
{
super(deserializer);
}
@Override
public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config) {
if (noise > 1.9D) {
SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, BOPBiomeFeatures.GRANITE_SURFACE);
} else {
SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG);
}
}
}

View file

@ -1,20 +1,28 @@
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import biomesoplenty.api.block.BOPBlocks;
import net.minecraft.block.BlockLeaves;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.Blocks;
import net.minecraft.block.LeavesBlock;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.gen.IChunkGenSettings;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.GenerationSettings;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import java.util.Random;
import java.util.function.Function;
public class HeathFeature extends Feature<NoFeatureConfig>
{
public boolean place(IWorld p_212245_1_, IChunkGenerator<? extends IChunkGenSettings> p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_)
public HeathFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
@Override
public boolean place(IWorld p_212245_1_, ChunkGenerator<? extends GenerationSettings> p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_)
{
int i = 0;
@ -23,7 +31,7 @@ public class HeathFeature extends Feature<NoFeatureConfig>
BlockPos blockpos = p_212245_4_.add(p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8), p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4), p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8));
if (p_212245_1_.getBlockState(blockpos).canBeReplacedByLeaves(p_212245_1_, blockpos) && p_212245_1_.getBlockState(blockpos.down()).getBlock() == Blocks.GRASS_BLOCK)
{
p_212245_1_.setBlockState(blockpos, BOPBlocks.jacaranda_leaves.getDefaultState().with(BlockLeaves.PERSISTENT, true), 2);
p_212245_1_.setBlockState(blockpos, BOPBlocks.jacaranda_leaves.getDefaultState().with(LeavesBlock.PERSISTENT, true), 2);
++i;
}

View file

@ -7,16 +7,25 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import biomesoplenty.api.block.BOPBlocks;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.gen.feature.AbstractFlowersFeature;
import net.minecraft.world.gen.feature.FlowersFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
public class JungleFlowersFeature extends AbstractFlowersFeature
import java.util.Random;
import java.util.function.Function;
public class JungleFlowersFeature extends FlowersFeature
{
public JungleFlowersFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
@Override
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{
int j = p_202355_1_.nextInt(3);

View file

@ -7,24 +7,33 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import biomesoplenty.api.block.BOPBlocks;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.AbstractFlowersFeature;
import net.minecraft.world.gen.feature.FlowersFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
public class LavenderFlowersFeature extends AbstractFlowersFeature
import java.util.Random;
import java.util.function.Function;
public class LavenderFlowersFeature extends FlowersFeature
{
private static final Block[] FLOWERS = new Block[]{BOPBlocks.lavender};
private static final Block[] FLOWERS = new Block[]{BOPBlocks.lavender};
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)];
return block.getDefaultState();
}
}
public LavenderFlowersFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
@Override
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)];
return block.getDefaultState();
}
}

View file

@ -7,19 +7,25 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import biomesoplenty.api.block.BOPBlocks;
import net.minecraft.block.Block;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.AbstractFlowersFeature;
import net.minecraft.world.gen.feature.FlowersFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
public class LushGrasslandFlowersFeature extends AbstractFlowersFeature
import java.util.Random;
import java.util.function.Function;
public class LushGrasslandFlowersFeature extends FlowersFeature
{
public LushGrasslandFlowersFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
@Override
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{
int j = p_202355_1_.nextInt(2);

View file

@ -7,25 +7,34 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import biomesoplenty.api.block.BOPBlocks;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.AbstractFlowersFeature;
import net.minecraft.world.gen.feature.FlowersFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
public class LushSwampFlowersFeature extends AbstractFlowersFeature
import java.util.Random;
import java.util.function.Function;
public class LushSwampFlowersFeature extends FlowersFeature
{
private static final Block[] FLOWERS = new Block[]{BOPBlocks.blue_hydrangea, Blocks.BLUE_ORCHID, Blocks.AZURE_BLUET, Blocks.DANDELION, Blocks.POPPY};
private static final Block[] FLOWERS = new Block[]{BOPBlocks.blue_hydrangea, Blocks.BLUE_ORCHID, Blocks.AZURE_BLUET, Blocks.DANDELION, Blocks.POPPY};
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)];
return block.getDefaultState();
}
}
public LushSwampFlowersFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
@Override
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)];
return block.getDefaultState();
}
}

View file

@ -1,67 +1,77 @@
package biomesoplenty.common.world.gen.feature;
import java.util.Random;
import biomesoplenty.api.block.BOPBlocks;
import net.minecraft.block.BlockLeaves;
import com.mojang.datafixers.Dynamic;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.LeavesBlock;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.gen.IChunkGenSettings;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.GenerationSettings;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import java.util.Random;
import java.util.function.Function;
public class MangroveFeature extends Feature<NoFeatureConfig> {
public boolean place(IWorld p_212245_1_, IChunkGenerator<? extends IChunkGenSettings> p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) {
int i = 0;
BlockState BlockState = BOPBlocks.mangrove_root.getDefaultState();
for(int j = 0; j < 64; ++j) {
BlockPos blockpos = p_212245_4_.add(p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8), p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4), p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8));
if (p_212245_1_.isAirBlock(blockpos) && (!p_212245_1_.getDimension().isNether() || blockpos.getY() < p_212245_1_.getWorld().getHeight() - 1) && BlockState.isValidPosition(p_212245_1_, blockpos)) {
p_212245_1_.setBlockState(blockpos, BlockState, 2);
BlockPos leaves1 = blockpos.up();
BlockPos leaves2 = leaves1.north();
BlockPos leaves3 = leaves1.south();
BlockPos leaves4 = leaves1.east();
BlockPos leaves5 = leaves1.west();
BlockPos leaves6 = leaves1.up();
if (p_212245_1_.getBlockState(leaves1).canBeReplacedByLeaves(p_212245_1_, leaves1))
{
p_212245_1_.setBlockState(leaves1, Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true), 2);
}
if (p_212245_3_.nextInt(2) == 0)
{
if (p_212245_1_.getBlockState(leaves2).canBeReplacedByLeaves(p_212245_1_, leaves2))
{
p_212245_1_.setBlockState(leaves2, Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true), 2);
}
if (p_212245_1_.getBlockState(leaves3).canBeReplacedByLeaves(p_212245_1_, leaves3))
{
p_212245_1_.setBlockState(leaves3, Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true), 2);
}
if (p_212245_1_.getBlockState(leaves4).canBeReplacedByLeaves(p_212245_1_, leaves4))
{
p_212245_1_.setBlockState(leaves4, Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true), 2);
}
if (p_212245_1_.getBlockState(leaves5).canBeReplacedByLeaves(p_212245_1_, leaves5))
{
p_212245_1_.setBlockState(leaves5, Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true), 2);
}
if (p_212245_1_.getBlockState(leaves6).canBeReplacedByLeaves(p_212245_1_, leaves6))
{
p_212245_1_.setBlockState(leaves6, Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, true), 2);
}
}
++i;
}
}
public MangroveFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> deserializer)
{
super(deserializer);
}
return i > 0;
}
}
@Override
public boolean place(IWorld p_212245_1_, ChunkGenerator<? extends GenerationSettings> p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_)
{
int i = 0;
BlockState BlockState = BOPBlocks.mangrove_root.getDefaultState();
for(int j = 0; j < 64; ++j) {
BlockPos blockpos = p_212245_4_.add(p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8), p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4), p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8));
if (p_212245_1_.isAirBlock(blockpos) && (!p_212245_1_.getDimension().isNether() || blockpos.getY() < p_212245_1_.getWorld().getHeight() - 1) && BlockState.isValidPosition(p_212245_1_, blockpos)) {
p_212245_1_.setBlockState(blockpos, BlockState, 2);
BlockPos leaves1 = blockpos.up();
BlockPos leaves2 = leaves1.north();
BlockPos leaves3 = leaves1.south();
BlockPos leaves4 = leaves1.east();
BlockPos leaves5 = leaves1.west();
BlockPos leaves6 = leaves1.up();
if (p_212245_1_.getBlockState(leaves1).canBeReplacedByLeaves(p_212245_1_, leaves1))
{
p_212245_1_.setBlockState(leaves1, Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true), 2);
}
if (p_212245_3_.nextInt(2) == 0)
{
if (p_212245_1_.getBlockState(leaves2).canBeReplacedByLeaves(p_212245_1_, leaves2))
{
p_212245_1_.setBlockState(leaves2, Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true), 2);
}
if (p_212245_1_.getBlockState(leaves3).canBeReplacedByLeaves(p_212245_1_, leaves3))
{
p_212245_1_.setBlockState(leaves3, Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true), 2);
}
if (p_212245_1_.getBlockState(leaves4).canBeReplacedByLeaves(p_212245_1_, leaves4))
{
p_212245_1_.setBlockState(leaves4, Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true), 2);
}
if (p_212245_1_.getBlockState(leaves5).canBeReplacedByLeaves(p_212245_1_, leaves5))
{
p_212245_1_.setBlockState(leaves5, Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true), 2);
}
if (p_212245_1_.getBlockState(leaves6).canBeReplacedByLeaves(p_212245_1_, leaves6))
{
p_212245_1_.setBlockState(leaves6, Blocks.OAK_LEAVES.getDefaultState().with(LeavesBlock.PERSISTENT, true), 2);
}
}
++i;
}
}
return i > 0;
}
}

View file

@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap;
import com.mojang.datafixers.Dynamic;
import com.mojang.datafixers.types.DynamicOps;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.world.gen.feature.IFeatureConfig;
import java.util.List;
@ -30,4 +31,13 @@ public class SplotchConfig implements IFeatureConfig
return BlockState.serialize(dynamicOps, p_214692_1_).getValue();
})))));
}
public static <T> SplotchConfig deserialize(Dynamic<T> dynamicOps)
{
BlockState lvt_1_1_ = (BlockState)dynamicOps.get("state").map(BlockState::deserialize).orElse(Blocks.AIR.getDefaultState());
int lvt_2_1_ = dynamicOps.get("radius").asInt(0);
int lvt_3_1_ = dynamicOps.get("y_size").asInt(0);
List<BlockState> lvt_4_1_ = dynamicOps.get("targets").asList(BlockState::deserialize);
return new SplotchConfig(lvt_1_1_, lvt_2_1_, lvt_3_1_, lvt_4_1_);
}
}

View file

@ -25,7 +25,7 @@ public enum GenLayerBiomeBOP implements IAreaTransformer2, IDimOffset0Transforme
private static final int MUSHROOM_FIELDS = Registry.BIOME.getId(Biomes.MUSHROOM_FIELDS);
@Override
public int func_215723_a(INoiseRandom context, IArea area1, IArea area2, int x, int z)
public int apply(INoiseRandom context, IArea area1, IArea area2, int x, int z)
{
int landSeaVal = area1.getValue(x, z);
int climateVal = area2.getValue(x, z);

View file

@ -26,7 +26,7 @@ public enum GenLayerClimate implements IAreaTransformer2, IDimOffset0Transformer
}
@Override
public int func_215723_a(INoiseRandom context, IArea area1, IArea area2, int x, int z)
public int apply(INoiseRandom context, IArea area1, IArea area2, int x, int z)
{
int temperature = area1.getValue(x, z);
int rainfall = area2.getValue(x, z);

View file

@ -20,7 +20,7 @@ public enum GenLayerLargeIsland implements IAreaTransformer2, IDimOffset1Transfo
INSTANCE;
@Override
public int func_215723_a(INoiseRandom context, IArea landSeaArea, IArea climateArea, int x, int z)
public int apply(INoiseRandom context, IArea landSeaArea, IArea climateArea, int x, int z)
{
int northVal = landSeaArea.getValue(x + 1, z + 0);
int eastVal = landSeaArea.getValue(x + 2, z + 1);

View file

@ -28,7 +28,7 @@ public enum GenLayerRiverMixBOP implements IAreaTransformer2, IDimOffset0Transfo
private static final int RIVER = Registry.BIOME.getId(Biomes.RIVER);
@Override
public int func_215723_a(INoiseRandom context, IArea biomeArea, IArea riverArea, int x, int z)
public int apply(INoiseRandom context, IArea biomeArea, IArea riverArea, int x, int z)
{
int biomeId = biomeArea.getValue(x, z);
int riverId = riverArea.getValue(x, z);

View file

@ -54,7 +54,7 @@ public enum GenLayerSubBiome implements IAreaTransformer2, IDimOffset1Transforme
private static final int TAIGA_HILLS = Registry.BIOME.getId(Biomes.TAIGA_HILLS);
@Override
public int func_215723_a(INoiseRandom context, IArea biomeArea, IArea riverAndSubBiomesInitArea, int x, int z)
public int apply(INoiseRandom context, IArea biomeArea, IArea riverAndSubBiomesInitArea, int x, int z)
{
int biomeId = biomeArea.getValue(x + 1, z + 1);
int initVal = riverAndSubBiomesInitArea.getValue(x + 1, z + 1);