diff --git a/src/main/java/biomesoplenty/api/biome/BOPBiomes.java b/src/main/java/biomesoplenty/api/biome/BOPBiomes.java index a323a976d..3179f1f47 100644 --- a/src/main/java/biomesoplenty/api/biome/BOPBiomes.java +++ b/src/main/java/biomesoplenty/api/biome/BOPBiomes.java @@ -131,6 +131,7 @@ public class BOPBiomes public static IExtendedBiome mega_taiga_extension; public static IExtendedBiome mega_taiga_hills_extension; public static IExtendedBiome hell_extension; + public static IExtendedBiome beach_extension; private static IBiomeRegistry createRegistry() { diff --git a/src/main/java/biomesoplenty/common/biome/vanilla/BiomeExtBeach.java b/src/main/java/biomesoplenty/common/biome/vanilla/BiomeExtBeach.java new file mode 100644 index 000000000..8d1e1b823 --- /dev/null +++ b/src/main/java/biomesoplenty/common/biome/vanilla/BiomeExtBeach.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright 2014-2017, the Biomes O' Plenty Team + * + * This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License. + * + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + ******************************************************************************/ +package biomesoplenty.common.biome.vanilla; + +import biomesoplenty.api.generation.GeneratorStage; +import biomesoplenty.common.block.BlockBOPDoublePlant; +import biomesoplenty.common.world.generator.GeneratorDoubleFlora; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.init.Biomes; +import net.minecraft.init.Blocks; + +public class BiomeExtBeach extends ExtendedBiomeWrapper +{ + public BiomeExtBeach() + { + super(Biomes.BEACH); + + this.addGenerator("sea_oats", GeneratorStage.FLOWERS,(new GeneratorDoubleFlora.Builder()).amountPerChunk(10.0F).placeOn(Blocks.SAND.getDefaultState()).with(BlockBOPDoublePlant.DoublePlantType.SEA_OATS).generationAttempts(128).create()); + } +} + diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPDoublePlant.java b/src/main/java/biomesoplenty/common/block/BlockBOPDoublePlant.java index 8aacbe1b1..fd8b908d1 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPDoublePlant.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPDoublePlant.java @@ -44,7 +44,7 @@ public class BlockBOPDoublePlant extends BlockBOPDoubleDecoration implements ISh // add properties (note we inherit HALF from BlockDoubleDecoration) public enum DoublePlantType implements IStringSerializable { - FLAX, TALL_CATTAIL, EYEBULB; + FLAX, TALL_CATTAIL, EYEBULB, SEA_OATS; @Override public String getName() { @@ -149,6 +149,8 @@ public class BlockBOPDoublePlant extends BlockBOPDoubleDecoration implements ISh return BlockQueries.litFertileWaterside.matches(world, lowerPos.down()); case EYEBULB: return BlockQueries.hellish.matches(world, lowerPos.down()); + case SEA_OATS: + return BlockQueries.fertileOrSand.matches(world, lowerPos.down()); case FLAX: default: return BlockQueries.litFertile.matches(world, lowerPos.down()); } @@ -184,7 +186,7 @@ public class BlockBOPDoublePlant extends BlockBOPDoubleDecoration implements ISh DoublePlantType type = (DoublePlantType) lowerState.getValue(VARIANT); switch (type) { - case FLAX: + case FLAX: case SEA_OATS: break; case TALL_CATTAIL: ret.add(BlockBOPPlant.paging.getVariantItem(BOPPlants.CATTAIL)); @@ -218,7 +220,7 @@ public class BlockBOPDoublePlant extends BlockBOPDoubleDecoration implements ISh DoublePlantType type = (DoublePlantType) lowerState.getValue(VARIANT); switch (type) { - case FLAX: + case FLAX: case SEA_OATS: ret.add(this.getVariantItem(type)); default: break; diff --git a/src/main/java/biomesoplenty/common/init/ModBiomes.java b/src/main/java/biomesoplenty/common/init/ModBiomes.java index c6e87e342..607e1d3a2 100644 --- a/src/main/java/biomesoplenty/common/init/ModBiomes.java +++ b/src/main/java/biomesoplenty/common/init/ModBiomes.java @@ -20,7 +20,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import net.minecraftforge.fml.common.registry.ForgeRegistries; import org.apache.commons.io.FileUtils; import com.google.common.base.Optional; @@ -102,6 +101,7 @@ import biomesoplenty.common.biome.overworld.BiomeGenWetland; import biomesoplenty.common.biome.overworld.BiomeGenWhiteBeach; import biomesoplenty.common.biome.overworld.BiomeGenWoodland; import biomesoplenty.common.biome.overworld.BiomeGenXericShrubland; +import biomesoplenty.common.biome.vanilla.BiomeExtBeach; import biomesoplenty.common.biome.vanilla.BiomeExtBirchForest; import biomesoplenty.common.biome.vanilla.BiomeExtBirchForestHills; import biomesoplenty.common.biome.vanilla.BiomeExtColdTaiga; @@ -144,6 +144,7 @@ import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.BiomeDictionary.Type; import net.minecraftforge.common.BiomeManager; import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.fml.common.registry.ForgeRegistries; public class ModBiomes implements BOPBiomes.IBiomeRegistry { @@ -389,6 +390,7 @@ public class ModBiomes implements BOPBiomes.IBiomeRegistry taiga_extension = registerWrappedBiome(new BiomeExtTaiga()); taiga_hills_extension = registerWrappedBiome(new BiomeExtTaigaHills()); hell_extension = registerWrappedBiome(new BiomeExtHell()); + beach_extension = registerWrappedBiome(new BiomeExtBeach()); } private static void registerBiomeDictionaryTags() diff --git a/src/main/java/biomesoplenty/common/world/generator/GeneratorDoubleFlora.java b/src/main/java/biomesoplenty/common/world/generator/GeneratorDoubleFlora.java index e74c92c23..f6a0e2e15 100644 --- a/src/main/java/biomesoplenty/common/world/generator/GeneratorDoubleFlora.java +++ b/src/main/java/biomesoplenty/common/world/generator/GeneratorDoubleFlora.java @@ -22,6 +22,7 @@ import biomesoplenty.common.util.block.BlockQuery.BlockQueryMaterial; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.BlockDoublePlant; +import net.minecraft.block.BlockGrass; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -93,6 +94,28 @@ public class GeneratorDoubleFlora extends GeneratorReplacing { BlockPos genPos = pos.add(random.nextInt(8) - random.nextInt(8), random.nextInt(4) - random.nextInt(4), random.nextInt(8) - random.nextInt(8)); + if (this.with == BOPBlocks.double_plant.getDefaultState().withProperty(BlockBOPDoublePlant.VARIANT, BlockBOPDoublePlant.DoublePlantType.SEA_OATS).withProperty(BlockBOPDoublePlant.HALF, BlockBOPDoubleDecoration.Half.LOWER)) + { + boolean grassCheck = false; + + for (int x = -4; x < 4; ++x) + { + for (int y = -4; y < 4; ++y) + { + for (int z = -4; z < 4; ++z) + { + if (world.getBlockState(genPos.down().add(x, y, z)).getBlock() instanceof BlockGrass) + { + grassCheck = true; + break; + } + } + } + } + + if (!grassCheck) { return false; } + } + if (this.placeOn.matches(world, genPos.down()) && this.replace.matches(world, genPos) && this.replace.matches(world, genPos.up()) && genPos.getY() < 254) { boolean canStay; diff --git a/src/main/resources/assets/biomesoplenty/blockstates/double_plant.json b/src/main/resources/assets/biomesoplenty/blockstates/double_plant.json index e40170997..0e16452dc 100644 --- a/src/main/resources/assets/biomesoplenty/blockstates/double_plant.json +++ b/src/main/resources/assets/biomesoplenty/blockstates/double_plant.json @@ -5,6 +5,8 @@ "half=upper,variant=tall_cattail": { "model": "biomesoplenty:tall_cattail_upper" }, "half=lower,variant=tall_cattail": { "model": "biomesoplenty:tall_cattail_lower" }, "half=upper,variant=eyebulb": { "model": "biomesoplenty:eyebulb_upper" }, - "half=lower,variant=eyebulb": { "model": "biomesoplenty:eyebulb_lower" } + "half=lower,variant=eyebulb": { "model": "biomesoplenty:eyebulb_lower" }, + "half=upper,variant=sea_oats": { "model": "biomesoplenty:sea_oats_upper" }, + "half=lower,variant=sea_oats": { "model": "biomesoplenty:sea_oats_lower" } } } \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index 25c917aac..32c0a276e 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -157,6 +157,7 @@ tile.dirt.coarse_silty_dirt.name=Coarse Silty Dirt tile.double_plant.flax.name=Flax tile.double_plant.tall_cattail.name=Tall Cattail tile.double_plant.eyebulb.name=Eyebulb +tile.double_plant.sea_oats.name=Sea Oats tile.ebony_fence.name=Ebony Fence tile.ebony_fence_gate.name=Ebony Fence Gate tile.ebony_wood_slab.name=Ebony Wood Slab diff --git a/src/main/resources/assets/biomesoplenty/models/block/sea_oats_lower.json b/src/main/resources/assets/biomesoplenty/models/block/sea_oats_lower.json new file mode 100644 index 000000000..291011941 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/sea_oats_lower.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cross", + "textures": { + "cross": "biomesoplenty:blocks/sea_oats_lower" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/sea_oats_upper.json b/src/main/resources/assets/biomesoplenty/models/block/sea_oats_upper.json new file mode 100644 index 000000000..71f0d63e9 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/sea_oats_upper.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cross", + "textures": { + "cross": "biomesoplenty:blocks/sea_oats_upper" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/item/sea_oats.json b/src/main/resources/assets/biomesoplenty/models/item/sea_oats.json new file mode 100644 index 000000000..566075c47 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/sea_oats.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "biomesoplenty:blocks/sea_oats_upper" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/sea_oats_lower.png b/src/main/resources/assets/biomesoplenty/textures/blocks/sea_oats_lower.png new file mode 100644 index 000000000..bbaa477c2 Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/sea_oats_lower.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/sea_oats_upper.png b/src/main/resources/assets/biomesoplenty/textures/blocks/sea_oats_upper.png new file mode 100644 index 000000000..001e690af Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/sea_oats_upper.png differ