Skip to content

Commit

Permalink
Fix flower gen, cherry bottom slab has wrong sound
Browse files Browse the repository at this point in the history
  • Loading branch information
Roadhog360 committed Nov 18, 2023
1 parent e82b61a commit 6c37c36
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 49 deletions.
41 changes: 16 additions & 25 deletions src/main/java/ganymedes01/etfuturum/EtFuturum.java
Original file line number Diff line number Diff line change
Expand Up @@ -566,39 +566,23 @@ public float getPitch(World world, int x, int y, int z, float pitch, MultiBlockS
MultiBlockSoundRegistry.multiBlockSounds.put(ModBlocks.LEAVES.get(), mbs);
}

if (ModBlocks.WOOD_PLANKS.isEnabled()) {
BasicMultiBlockSound mbs = new BasicMultiBlockSound();
mbs.setTypes(0, ModSounds.soundNetherWood);
mbs.setTypes(1, ModSounds.soundNetherWood);
mbs.setTypes(3, ModSounds.soundCherryWood);
mbs.setTypes(4, ModSounds.soundBambooWood);
MultiBlockSoundRegistry.multiBlockSounds.put(ModBlocks.WOOD_PLANKS.get(), mbs);
}

if (ModBlocks.WOOD_FENCE.isEnabled()) {
{
BasicMultiBlockSound mbs = new BasicMultiBlockSound();
mbs.setTypes(0, ModSounds.soundNetherWood);
mbs.setTypes(1, ModSounds.soundNetherWood);
mbs.setTypes(3, ModSounds.soundCherryWood);
mbs.setTypes(4, ModSounds.soundBambooWood);
MultiBlockSoundRegistry.multiBlockSounds.put(ModBlocks.WOOD_FENCE.get(), mbs);
}

if (ModBlocks.WOOD_SLAB.isEnabled()) {
BasicMultiBlockSound mbs = new BasicMultiBlockSound();
mbs.setTypes(0, ModSounds.soundNetherWood);
mbs.setTypes(1, ModSounds.soundNetherWood);
mbs.setTypes(3, ModSounds.soundNetherWood);
mbs.setTypes(4, ModSounds.soundBambooWood);
if (ModBlocks.WOOD_PLANKS.isEnabled()) {
MultiBlockSoundRegistry.multiBlockSounds.put(ModBlocks.WOOD_PLANKS.get(), mbs);
}

mbs.setTypes(8, ModSounds.soundNetherWood);
mbs.setTypes(9, ModSounds.soundNetherWood);
mbs.setTypes(11, ModSounds.soundCherryWood);
mbs.setTypes(12, ModSounds.soundBambooWood);
MultiBlockSoundRegistry.multiBlockSounds.put(ModBlocks.WOOD_SLAB.get(), mbs);
if (ModBlocks.WOOD_FENCE.isEnabled()) {
MultiBlockSoundRegistry.multiBlockSounds.put(ModBlocks.WOOD_FENCE.get(), mbs);
}
}

if (ModBlocks.DOUBLE_WOOD_SLAB.isEnabled()) {
{
BasicMultiBlockSound mbs = new BasicMultiBlockSound();
mbs.setTypes(0, ModSounds.soundNetherWood);
mbs.setTypes(1, ModSounds.soundNetherWood);
Expand All @@ -609,7 +593,14 @@ public float getPitch(World world, int x, int y, int z, float pitch, MultiBlockS
mbs.setTypes(9, ModSounds.soundNetherWood);
mbs.setTypes(11, ModSounds.soundCherryWood);
mbs.setTypes(12, ModSounds.soundBambooWood);
MultiBlockSoundRegistry.multiBlockSounds.put(ModBlocks.DOUBLE_WOOD_SLAB.get(), mbs);

if (ModBlocks.WOOD_SLAB.isEnabled()) {
MultiBlockSoundRegistry.multiBlockSounds.put(ModBlocks.WOOD_SLAB.get(), mbs);
}

if (ModBlocks.DOUBLE_WOOD_SLAB.isEnabled()) {
MultiBlockSoundRegistry.multiBlockSounds.put(ModBlocks.DOUBLE_WOOD_SLAB.get(), mbs);
}
}

if (ModBlocks.PACKED_MUD.isEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderFlat;
import net.minecraft.world.gen.feature.WorldGenFlowers;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.BiomeDictionary;
Expand Down Expand Up @@ -48,45 +49,58 @@ public class EtFuturumWorldGenerator implements IWorldGenerator {
protected final WorldGenMinable tuffGen = new WorldGenDeepslateLayerBlob(ConfigWorld.maxTuffPerCluster, true);
protected WorldGenerator amethystGen;
protected WorldGenerator fossilGen;
private final LinkedList<BiomeGenBase> fossilBiomes;
protected WorldGenerator berryBushGen;
protected WorldGenerator cornflowerGen;
protected WorldGenerator lilyValleyGen;
private List<BiomeGenBase> fossilBiomes;
private List<BiomeGenBase> berryBushBiomes;
private List<BiomeGenBase> cornflowerBiomes;
private List<BiomeGenBase> lilyValleyBiomes;

protected EtFuturumWorldGenerator() {
stoneGen.add(new WorldGenMinableCustom(ModBlocks.STONE.get(), 1, ConfigWorld.maxStonesPerCluster, Blocks.stone));
stoneGen.add(new WorldGenMinableCustom(ModBlocks.STONE.get(), 3, ConfigWorld.maxStonesPerCluster, Blocks.stone));
stoneGen.add(new WorldGenMinableCustom(ModBlocks.STONE.get(), 5, ConfigWorld.maxStonesPerCluster, Blocks.stone));
//Add biomes that are only hot, AND dry AND sandy, and add all swamps.
fossilBiomes = new LinkedList<>(Arrays.asList(BiomeDictionary.getBiomesForType(Type.SANDY)));
fossilBiomes.retainAll(Arrays.asList(BiomeDictionary.getBiomesForType(Type.HOT)));
fossilBiomes.retainAll(Arrays.asList(BiomeDictionary.getBiomesForType(Type.DRY)));
fossilBiomes.addAll(Arrays.asList(BiomeDictionary.getBiomesForType(Type.SWAMP)));
}

public void postInit() {
if (ConfigWorld.enableAmethystGeodes && ModBlocks.AMETHYST_BLOCK.isEnabled() && ModBlocks.AMETHYST_CLUSTER_1.isEnabled() && ModBlocks.AMETHYST_CLUSTER_2.isEnabled()
&& ModBlocks.BUDDING_AMETHYST.isEnabled() && ConfigWorld.amethystOuterBlock != null && ConfigWorld.amethystMiddleBlock != null) {
amethystGen = new WorldGenAmethystGeode(ConfigWorld.amethystOuterBlock, ConfigWorld.amethystMiddleBlock);
}

if (ConfigWorld.enableFossils && ConfigWorld.fossilBlock != null) {
fossilGen = new WorldGenFossil();
}

//Add biomes that are only hot, AND dry AND sandy, and add all swamps.
fossilBiomes = new LinkedList<>(Arrays.asList(BiomeDictionary.getBiomesForType(Type.SANDY)));
fossilBiomes.retainAll(Arrays.asList(BiomeDictionary.getBiomesForType(Type.HOT)));
fossilBiomes.retainAll(Arrays.asList(BiomeDictionary.getBiomesForType(Type.DRY)));
fossilBiomes.addAll(Arrays.asList(BiomeDictionary.getBiomesForType(Type.SWAMP)));

if (ModBlocks.SWEET_BERRY_BUSH.isEnabled()) {
berryBushBiomes = new LinkedList<>(Arrays.asList(BiomeDictionary.getBiomesForType(Type.CONIFEROUS)));
berryBushGen = new WorldGenFlowers(ModBlocks.SWEET_BERRY_BUSH.get());
((WorldGenFlowers) berryBushGen).func_150550_a(ModBlocks.SWEET_BERRY_BUSH.get(), 3);
}

if (ModBlocks.LILY_OF_THE_VALLEY.isEnabled()) {
BiomeGenBase[] biomes = BiomeDictionary.getBiomesForType(Type.FOREST);
biomes = ArrayUtils.removeElements(biomes, BiomeDictionary.getBiomesForType(Type.SNOWY));
for (BiomeGenBase biome : biomes) {
biome.addFlower(ModBlocks.LILY_OF_THE_VALLEY.get(), 0, 1);
}
BiomeGenBase[] lilyValleyBiomeArray = BiomeDictionary.getBiomesForType(Type.FOREST);
lilyValleyBiomeArray = ArrayUtils.removeElements(lilyValleyBiomeArray, BiomeDictionary.getBiomesForType(Type.SNOWY));
lilyValleyBiomes = Arrays.asList(lilyValleyBiomeArray);
lilyValleyGen = new WorldGenFlowers(ModBlocks.LILY_OF_THE_VALLEY.get());
}

if (ModBlocks.CORNFLOWER.isEnabled()) {
BiomeGenBase[] biomes = BiomeDictionary.getBiomesForType(Type.PLAINS);
biomes = ArrayUtils.removeElements(biomes, BiomeDictionary.getBiomesForType(Type.SAVANNA));
biomes = ArrayUtils.removeElements(biomes, BiomeDictionary.getBiomesForType(Type.SNOWY));
for (BiomeGenBase biome : biomes) {
biome.addFlower(ModBlocks.CORNFLOWER.get(), 0, 1);
}
}
if (ModBlocks.SWEET_BERRY_BUSH.isEnabled()) {
for (BiomeGenBase biome : BiomeDictionary.getBiomesForType(Type.CONIFEROUS)) {
biome.addFlower(ModBlocks.SWEET_BERRY_BUSH.get(), 3, 1);
BiomeGenBase[] cornflowerBiomeArray = BiomeDictionary.getBiomesForType(Type.PLAINS);
cornflowerBiomeArray = ArrayUtils.removeElements(cornflowerBiomeArray, BiomeDictionary.getBiomesForType(Type.SAVANNA));
cornflowerBiomeArray = ArrayUtils.removeElements(cornflowerBiomeArray, BiomeDictionary.getBiomesForType(Type.SNOWY));
cornflowerBiomeArray = ArrayUtils.removeElements(cornflowerBiomeArray, BiomeDictionary.getBiomesForType(Type.SANDY));
cornflowerBiomes = Arrays.asList(cornflowerBiomeArray);
cornflowerGen = new WorldGenFlowers(ModBlocks.CORNFLOWER.get());
for (BiomeGenBase biome : cornflowerBiomes) {
biome.addFlower(ModBlocks.CORNFLOWER.get(), 0, 5);
}
}
}
Expand Down Expand Up @@ -115,6 +129,30 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkPro
}
}

if (lilyValleyGen != null) {
x = (chunkX << 4) + rand.nextInt(16) + 8;
z = (chunkZ << 4) + rand.nextInt(16) + 8;
if (world.getHeightValue(x, z) > 0 && lilyValleyBiomes.contains(world.getBiomeGenForCoords(x, z))) {
lilyValleyGen.generate(world, rand, x, nextHeightInt(rand, world.getHeightValue(x, z) * 2), z);
}
}

if (cornflowerGen != null) {
x = (chunkX << 4) + rand.nextInt(16) + 8;
z = (chunkZ << 4) + rand.nextInt(16) + 8;
if (world.getHeightValue(x, z) > 0 && cornflowerBiomes.contains(world.getBiomeGenForCoords(x, z))) {
cornflowerGen.generate(world, rand, x, nextHeightInt(rand, world.getHeightValue(x, z) * 2), z);
}
}

if (berryBushGen != null) {
x = (chunkX << 4) + rand.nextInt(16) + 8;
z = (chunkZ << 4) + rand.nextInt(16) + 8;
if (world.getHeightValue(x, z) > 0 && berryBushBiomes.contains(world.getBiomeGenForCoords(x, z))) {
berryBushGen.generate(world, rand, x, nextHeightInt(rand, world.getHeightValue(x, z) * 2), z);
}
}

if (fossilGen != null && rand.nextInt(64) == 0 && ArrayUtils.contains(ConfigWorld.fossilDimensionBlacklist, world.provider.dimensionId) == ConfigWorld.fossilDimensionBlacklistAsWhitelist) {
x = (chunkX << 4) + rand.nextInt(16) + 8;
z = (chunkZ << 4) + rand.nextInt(16) + 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import ganymedes01.etfuturum.ModBlocks;
import ganymedes01.etfuturum.core.utils.Utils;
import ganymedes01.etfuturum.core.utils.helpers.BlockPos;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLog;
import net.minecraft.init.Blocks;
Expand Down Expand Up @@ -70,7 +69,6 @@ public boolean generate(World world, Random rand, int x, int y, int z) {
placeFoliage(world, x, y + treeHeight, z, rand);
}

BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
ForgeDirection direction = ForgeDirection.VALID_DIRECTIONS[rand.nextInt(4) + 2];
this.generateBranch(world, x, y, z, rand, height, direction, secondBranchOffsetFromTop, secondBranchOffsetFromTop < treeHeight - 1);
if (flag1) {
Expand Down Expand Up @@ -112,7 +110,7 @@ private void generateBranch(World world, int x, int y, int z, Random rand, int h
mutableX += logDir.offsetX;
mutableY += logDir.offsetY;
mutableZ += logDir.offsetZ;
setBlockAndNotifyAdequately(world, mutableX, mutableY, mutableZ, ModBlocks.CHERRY_LOG.get(), logDir.offsetY != 0 ? 0 : logDir.offsetX != 0 ? 4 : logDir.offsetZ != 0 ? 8 : 0);
setBlockAndNotifyAdequately(world, mutableX, mutableY, mutableZ, ModBlocks.CHERRY_LOG.get(), logDir.offsetX != 0 ? 4 : logDir.offsetZ != 0 ? 8 : 0);
}
}

Expand Down

0 comments on commit 6c37c36

Please sign in to comment.