diff --git a/src/main/java/biomesoplenty/api/block/BOPBlocks.java b/src/main/java/biomesoplenty/api/block/BOPBlocks.java index 566b94ce4..c8f4e0634 100644 --- a/src/main/java/biomesoplenty/api/block/BOPBlocks.java +++ b/src/main/java/biomesoplenty/api/block/BOPBlocks.java @@ -144,6 +144,8 @@ public class BOPBlocks public static Block plant_1; public static Block double_plant; + public static Block bramble_plant; + public static Block honey_block; public static Block jelled_poison; public static Block terrarium; diff --git a/src/main/java/biomesoplenty/common/biome/nether/BiomeCorruptedSands.java b/src/main/java/biomesoplenty/common/biome/nether/BiomeCorruptedSands.java index c7a1a644d..a3b1dc3f6 100644 --- a/src/main/java/biomesoplenty/common/biome/nether/BiomeCorruptedSands.java +++ b/src/main/java/biomesoplenty/common/biome/nether/BiomeCorruptedSands.java @@ -14,16 +14,12 @@ import biomesoplenty.api.config.IBOPWorldSettings.GeneratorType; import biomesoplenty.api.enums.BOPClimates; import biomesoplenty.api.enums.BOPPlants; import biomesoplenty.api.generation.GeneratorStage; -import biomesoplenty.common.block.BlockBOPGrass; import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.util.block.BlockQuery; +import biomesoplenty.common.world.generator.GeneratorBramble; import biomesoplenty.common.world.generator.GeneratorFlora; import biomesoplenty.common.world.generator.GeneratorLakes; import biomesoplenty.common.world.generator.GeneratorSplatter; -import biomesoplenty.common.world.generator.GeneratorWeighted; -import biomesoplenty.common.world.generator.tree.GeneratorBasicTree; -import biomesoplenty.common.world.generator.tree.GeneratorBigTree; -import net.minecraft.block.BlockPlanks; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -41,15 +37,13 @@ public class BiomeCorruptedSands extends BOPHellBiome this.hasBiomeEssence = false; - // quicksand - this.addGenerator("quicksand", GeneratorStage.SAND, (new GeneratorLakes.Builder()).amountPerChunk(5.0F).liquid(BOPBlocks.sand).frozenLiquid((IBlockState)null).scatterYMethod(ScatterYMethod.NETHER_SURFACE).create()); + IBlockPosQuery emptySoulsand = BlockQuery.buildAnd().withAirAbove().states(this.topBlock).create(); + this.addGenerator("bramble", GeneratorStage.FLOWERS,(new GeneratorBramble.Builder()).amountPerChunk(40.0F).placeOn(emptySoulsand).scatterYMethod(ScatterYMethod.NETHER_SURFACE).create()); // splatter top blocks - IBlockPosQuery emptySoulsand = BlockQuery.buildAnd().withAirAbove().states(this.topBlock).create(); - this.addGenerator("netherrack_splatter", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(5.0F).generationAttempts(128).scatterYMethod(ScatterYMethod.NETHER_SURFACE).replace(emptySoulsand).with(Blocks.NETHERRACK.getDefaultState()).create()); - + //this.addGenerator("netherrack_splatter", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(5.0F).generationAttempts(128).scatterYMethod(ScatterYMethod.NETHER_SURFACE).replace(emptySoulsand).with(Blocks.NETHERRACK.getDefaultState()).create()); this.addGenerator("dead_grass", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(5.0F).with(BOPPlants.DEADGRASS).scatterYMethod(ScatterYMethod.NETHER_SURFACE).create()); - this.addGenerator("thorns", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(20.0F).with(BOPPlants.THORN).scatterYMethod(ScatterYMethod.NETHER_SURFACE).create()); + this.addGenerator("thorns", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(3.0F).placeOn(emptySoulsand).with(BOPPlants.THORN).scatterYMethod(ScatterYMethod.NETHER_SURFACE).create()); } @Override diff --git a/src/main/java/biomesoplenty/common/biome/nether/BiomePhantasmagoricInferno.java b/src/main/java/biomesoplenty/common/biome/nether/BiomePhantasmagoricInferno.java index f42951a8f..251be8332 100644 --- a/src/main/java/biomesoplenty/common/biome/nether/BiomePhantasmagoricInferno.java +++ b/src/main/java/biomesoplenty/common/biome/nether/BiomePhantasmagoricInferno.java @@ -37,13 +37,12 @@ public class BiomePhantasmagoricInferno extends BOPHellBiome this.fillerBlock = BOPBlocks.ash_block.getDefaultState(); // lava lakes - this.addGenerator("lava_lakes", GeneratorStage.SAND, (new GeneratorLakes.Builder()).amountPerChunk(5.0F).liquid(Blocks.LAVA).frozenLiquid((IBlockState)null).scatterYMethod(ScatterYMethod.NETHER_SURFACE).create()); + this.addGenerator("lava_lakes", GeneratorStage.SAND, (new GeneratorLakes.Builder()).amountPerChunk(3.0F).lineWith(BOPBlocks.ash_block.getDefaultState()).liquid(Blocks.LAVA).frozenLiquid((IBlockState)null).scatterYMethod(ScatterYMethod.NETHER_SURFACE).create()); // splatter top blocks IBlockPosQuery emptyAsh = BlockQuery.buildAnd().withAirAbove().states(this.topBlock).create(); - this.addGenerator("magma_splatter", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(2.0F).generationAttempts(128).scatterYMethod(ScatterYMethod.NETHER_SURFACE).replace(emptyAsh).with(Blocks.MAGMA.getDefaultState()).create()); - - this.addGenerator("fire", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(5.0F).with(Blocks.FIRE.getDefaultState()).placeOn(emptyAsh).scatterYMethod(ScatterYMethod.NETHER_SURFACE).create()); + + this.addGenerator("fire", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(6.0F).with(Blocks.FIRE.getDefaultState()).placeOn(emptyAsh).scatterYMethod(ScatterYMethod.NETHER_SURFACE).create()); } @Override diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPBramblePlant.java b/src/main/java/biomesoplenty/common/block/BlockBOPBramblePlant.java new file mode 100644 index 000000000..a0e326489 --- /dev/null +++ b/src/main/java/biomesoplenty/common/block/BlockBOPBramblePlant.java @@ -0,0 +1,214 @@ +/******************************************************************************* + * Copyright 2014-2016, 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.block; + +import java.util.List; +import java.util.Random; + +import javax.annotation.Nullable; + +import biomesoplenty.api.enums.BOPPlants; +import biomesoplenty.common.item.ItemBOPBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockGrass; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockFaceShape; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.color.IBlockColor; +import net.minecraft.client.renderer.color.IItemColor; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.MobEffects; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class BlockBOPBramblePlant extends Block implements IBOPBlock +{ + public static final PropertyBool NORTH = PropertyBool.create("north"); + public static final PropertyBool EAST = PropertyBool.create("east"); + public static final PropertyBool SOUTH = PropertyBool.create("south"); + public static final PropertyBool WEST = PropertyBool.create("west"); + public static final PropertyBool UP = PropertyBool.create("up"); + public static final PropertyBool DOWN = PropertyBool.create("down"); + + // implement IBOPBlock + @Override + public Class getItemClass() { return ItemBOPBlock.class; } + @Override + public IProperty[] getPresetProperties() { return new IProperty[] {}; } + @Override + public IProperty[] getNonRenderingProperties() { return null; } + @Override + public String getStateName(IBlockState state) {return "";} + @Override + @SideOnly(Side.CLIENT) + public IBlockColor getBlockColor() { return null; } + @Override + @SideOnly(Side.CLIENT) + public IItemColor getItemColor() { return null; } + + public BlockBOPBramblePlant() { + super(Material.PLANTS); + this.setHardness(0.5F); + this.setHarvestLevel("axe", 0); + this.setSoundType(SoundType.WOOD); + this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(UP, Boolean.valueOf(false)).withProperty(DOWN, Boolean.valueOf(false))); + } + + @Override + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.down()).getBlock(); + Block block1 = worldIn.getBlockState(pos.up()).getBlock(); + Block block2 = worldIn.getBlockState(pos.north()).getBlock(); + Block block3 = worldIn.getBlockState(pos.east()).getBlock(); + Block block4 = worldIn.getBlockState(pos.south()).getBlock(); + Block block5 = worldIn.getBlockState(pos.west()).getBlock(); + return state.withProperty(DOWN, Boolean.valueOf(block == this || worldIn.getBlockState(pos.down()).isFullCube())).withProperty(UP, Boolean.valueOf(block1 == this || worldIn.getBlockState(pos.up()).isFullCube())).withProperty(NORTH, Boolean.valueOf(block2 == this || worldIn.getBlockState(pos.north()).isFullCube())).withProperty(EAST, Boolean.valueOf(block3 == this || worldIn.getBlockState(pos.east()).isFullCube())).withProperty(SOUTH, Boolean.valueOf(block4 == this || worldIn.getBlockState(pos.south()).isFullCube())).withProperty(WEST, Boolean.valueOf(block5 == this || worldIn.getBlockState(pos.west()).isFullCube())); + } + + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + state = state.getActualState(source, pos); + float f = 0.25F; + float f1 = 0.75F; + + float f2 = ((Boolean)state.getValue(WEST)).booleanValue() ? 0.0F : f; + float f3 = ((Boolean)state.getValue(DOWN)).booleanValue() ? 0.0F : f; + float f4 = ((Boolean)state.getValue(NORTH)).booleanValue() ? 0.0F : f; + float f5 = ((Boolean)state.getValue(EAST)).booleanValue() ? 1.0F : f1; + float f6 = ((Boolean)state.getValue(UP)).booleanValue() ? 1.0F : f1; + float f7 = ((Boolean)state.getValue(SOUTH)).booleanValue() ? 1.0F : f1; + return new AxisAlignedBB((double)f2, (double)f3, (double)f4, (double)f5, (double)f6, (double)f7); + } + + @Override + public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, @Nullable Entity entityIn, boolean isActualState) + { + if (!isActualState) + { + state = state.getActualState(worldIn, pos); + } + + float f = 0.25F; + float f1 = 0.75F; + addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(f, f, f, f1, f1, f1)); + + if (((Boolean)state.getValue(WEST)).booleanValue()) + { + addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(0.0D, f, f, f, f1, f1)); + } + + if (((Boolean)state.getValue(EAST)).booleanValue()) + { + addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(f1, f, f, 1.0D, f1, f1)); + } + + if (((Boolean)state.getValue(UP)).booleanValue()) + { + addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(f, f1, f, f1, 1.0D, f1)); + } + + if (((Boolean)state.getValue(DOWN)).booleanValue()) + { + addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(f, 0.0D, f, f1, f, f1)); + } + + if (((Boolean)state.getValue(NORTH)).booleanValue()) + { + addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(f, f, 0.0D, f1, f1, f)); + } + + if (((Boolean)state.getValue(SOUTH)).booleanValue()) + { + addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(f, f, f1, f1, f1, 1.0D)); + } + } + + @Override + public int getMetaFromState(IBlockState state) + { + return 0; + } + + @Override + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + entityIn.attackEntityFrom(DamageSource.CACTUS, 1.0F); + } + + @Override + public boolean isFullCube(IBlockState state) + { + return false; + } + + @Override + public boolean isOpaqueCube(IBlockState state) + { + return false; + } + + @Override + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return super.canPlaceBlockAt(worldIn, pos); + } + + @Override + protected BlockStateContainer createBlockState() + { + return new BlockStateContainer(this, new IProperty[] {NORTH, EAST, SOUTH, WEST, UP, DOWN}); + } + + @Override + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public BlockRenderLayer getBlockLayer() + { + return BlockRenderLayer.CUTOUT; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) + { + Block block = blockAccess.getBlockState(pos.offset(side)).getBlock(); + return block != this && (side != EnumFacing.DOWN || (!(blockState.isFullCube()))); + } + + @Override + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) + { + return BlockFaceShape.UNDEFINED; + } +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java b/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java index d102c5d0a..b19f0e358 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java @@ -263,26 +263,6 @@ public class BlockBOPPlant extends BlockBOPDecoration implements IShearable, IHo } - @Override - public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity tileentity, ItemStack stack) - { - super.harvestBlock(world, player, pos, state, tileentity, stack); - boolean usingShears = (stack != null && stack.getItem() instanceof ItemShears); - switch ((BOPPlants) state.getValue(this.variantProperty)) - { - // suffer cactus damage if you harvest thorn without shears - case THORN: - if (!usingShears) - { - player.attackEntityFrom(DamageSource.CACTUS, 2); - } - break; - - default: - break; - } - } - @Override public boolean isReplaceable(IBlockAccess world, BlockPos pos) { diff --git a/src/main/java/biomesoplenty/common/init/ModBlocks.java b/src/main/java/biomesoplenty/common/init/ModBlocks.java index 961b9b80c..fc0fa00e6 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -18,6 +18,7 @@ import biomesoplenty.api.item.BOPItems; import biomesoplenty.common.block.BlockBOPAsh; import biomesoplenty.common.block.BlockBOPBamboo; import biomesoplenty.common.block.BlockBOPBiomeBlock; +import biomesoplenty.common.block.BlockBOPBramblePlant; import biomesoplenty.common.block.BlockBOPCoral; import biomesoplenty.common.block.BlockBOPCrystal; import biomesoplenty.common.block.BlockBOPDirt; @@ -56,9 +57,9 @@ import biomesoplenty.common.block.BlockBOPTurnip; import biomesoplenty.common.block.BlockBOPVine; import biomesoplenty.common.block.BlockBOPWhiteSand; import biomesoplenty.common.block.BlockBOPWhiteSandstone; +import biomesoplenty.common.block.BlockBOPWhiteSandstone.StoneType; import biomesoplenty.common.block.BlockBOPWoodStairs; import biomesoplenty.common.block.IBOPBlock; -import biomesoplenty.common.block.BlockBOPWhiteSandstone.StoneType; import biomesoplenty.common.command.BOPCommand; import biomesoplenty.common.fluids.BloodFluid; import biomesoplenty.common.fluids.HoneyFluid; @@ -88,7 +89,6 @@ import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.registry.ForgeRegistries; -import net.minecraftforge.fml.common.registry.GameRegistry; public class ModBlocks { @@ -272,6 +272,8 @@ public class ModBlocks double_plant = registerBlock( new BlockBOPDoublePlant(), "double_plant" ); mushroom = registerBlock( new BlockBOPMushroom(), "mushroom" ); + bramble_plant = registerBlock ( new BlockBOPBramblePlant(), "bramble_plant" ); + // 22 flower types 16 per BlockBOPFlower instance, needs 2 'pages' BlockBOPFlower.createAllPages(); flower_0 = registerBlock( BlockBOPFlower.paging.getBlock(0), "flower_0" ); diff --git a/src/main/java/biomesoplenty/common/init/ModGenerators.java b/src/main/java/biomesoplenty/common/init/ModGenerators.java index 2e2fac230..637f73a1c 100644 --- a/src/main/java/biomesoplenty/common/init/ModGenerators.java +++ b/src/main/java/biomesoplenty/common/init/ModGenerators.java @@ -57,6 +57,7 @@ public class ModGenerators registerGenerator("blobs", GeneratorBlobs.class, new GeneratorBlobs.Builder()); registerGenerator("lakes", GeneratorLakes.class, new GeneratorLakes.Builder()); registerGenerator("columns", GeneratorColumns.class, new GeneratorColumns.Builder()); + registerGenerator("bramble", GeneratorBramble.class, new GeneratorBramble.Builder()); registerGenerator("vines", GeneratorVines.class, new GeneratorVines.Builder()); registerGenerator("mixed_lily", GeneratorMixedLily.class, new GeneratorMixedLily.Builder()); registerGenerator("crystals", GeneratorCrystals.class, new GeneratorCrystals.Builder()); diff --git a/src/main/java/biomesoplenty/common/world/generator/GeneratorBramble.java b/src/main/java/biomesoplenty/common/world/generator/GeneratorBramble.java new file mode 100644 index 000000000..e35801968 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/generator/GeneratorBramble.java @@ -0,0 +1,156 @@ +/******************************************************************************* + * Copyright 2015-2016, 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.world.generator; + +import java.util.Random; + +import biomesoplenty.api.block.BOPBlocks; +import biomesoplenty.api.block.BlockQueries; +import biomesoplenty.api.block.IBlockPosQuery; +import biomesoplenty.api.config.IConfigObj; +import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; +import biomesoplenty.common.util.block.BlockQuery.BlockQueryMaterial; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public class GeneratorBramble extends GeneratorReplacing +{ + + public static class Builder extends GeneratorReplacing.InnerBuilder implements IGeneratorBuilder + { + protected int minLength; + protected int maxLength; + protected int maxHeight; + protected int generationAttempts; + + public Builder minLength(int a) {this.minLength = a; return this.self();} + public Builder maxLength(int a) {this.maxLength = a; return this.self();} + public Builder maxHeight(int a) {this.maxHeight = a; return this.self();} + public Builder generationAttempts(int a) {this.generationAttempts = a; return this.self();} + + public Builder() + { + // defaults + this.amountPerChunk = 1.0F; + this.placeOn = new BlockQueryMaterial(Material.GROUND, Material.GRASS); + this.replace = BlockQueries.airOrLeaves; + this.with = BOPBlocks.bramble_plant.getDefaultState(); + this.scatterYMethod = ScatterYMethod.AT_SURFACE; + this.minLength = 15; + this.maxLength = 30; + this.maxHeight = 6; + this.generationAttempts = 128; + } + + @Override + public GeneratorBramble create() + { + return new GeneratorBramble(this.amountPerChunk, this.placeOn, this.replace, this.with, this.scatterYMethod, this.minLength, this.maxLength, this.maxHeight, this.generationAttempts); + } + } + + protected int minLength; + protected int maxLength; + protected int maxHeight; + protected int generationAttempts; + + public GeneratorBramble(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState with, ScatterYMethod scatterYMethod, int minLength, int maxLength, int maxHeight, int generationAttempts) + { + super(amountPerChunk, placeOn, replace, with, scatterYMethod); + this.minLength = minLength; + this.maxLength = maxLength; + this.maxHeight = maxHeight; + this.generationAttempts = generationAttempts; + } + + @Override + public boolean generate(World world, Random rand, BlockPos pos) + { + for (int i = 0; i < this.generationAttempts; ++i) + { + BlockPos genPos = pos.add(rand.nextInt(4) - rand.nextInt(4), rand.nextInt(3) - rand.nextInt(3), rand.nextInt(4) - rand.nextInt(4)); + + if (this.placeOn.matches(world, genPos.down()) && this.replace.matches(world, genPos)) + { + int targetLength = GeneratorUtils.nextIntBetween(rand, this.minLength, this.maxLength); + int height = 0; + int direction = rand.nextInt(4) + 2; + + for (int length = 0; length <= targetLength && replace.matches(world, genPos); length++) + { + if (this.with.getBlock().canPlaceBlockAt(world, genPos)) + { + world.setBlockState(genPos, this.with); + + if (rand.nextInt(2) == 0) + { + direction = rand.nextInt(4) + 2; + } + + if (rand.nextInt(2) == 0) + { + int leafDirection = rand.nextInt(6); + if (world.isAirBlock(genPos.offset(EnumFacing.values()[leafDirection]))) + { + world.setBlockState(genPos.offset(EnumFacing.values()[leafDirection]), Blocks.LEAVES.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false)); + } + } + + switch (rand.nextInt(6)) + { + case 0: case 1: + if (height <= this.maxHeight) + { + genPos = genPos.up(); + height++; + } + break; + case 2: + if (height >= 0) + { + genPos = genPos.down(); + height--; + } + break; + default: + genPos = genPos.offset(EnumFacing.values()[direction]); + break; + } + } + else + { + return false; + } + } + } + } + return true; + } + + @Override + public void configure(IConfigObj conf) + { + this.amountPerChunk = conf.getFloat("amountPerChunk", this.amountPerChunk); + this.with = conf.getBlockState("with", this.with); + this.minLength = conf.getInt("minLength", this.minLength); + this.maxLength = conf.getInt("maxLength", this.maxLength); + this.maxHeight = conf.getInt("maxHeight", this.maxHeight); + this.generationAttempts = conf.getInt("generationAttempts", this.generationAttempts); + this.placeOn = conf.getBlockPosQuery("placeOn", this.placeOn); + } + + +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/blockstates/bramble_plant.json b/src/main/resources/assets/biomesoplenty/blockstates/bramble_plant.json new file mode 100644 index 000000000..a36502703 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/blockstates/bramble_plant.json @@ -0,0 +1,23 @@ +{ + "multipart": [ + { "apply": { "model": "biomesoplenty:bramble_plant" }}, + { "when": { "north": true }, + "apply": { "model": "biomesoplenty:bramble_plant_side" } + }, + { "when": { "east": true }, + "apply": { "model": "biomesoplenty:bramble_plant_side", "y": 90, "uvlock": true } + }, + { "when": { "south": true }, + "apply": { "model": "biomesoplenty:bramble_plant_side", "y": 180, "uvlock": true } + }, + { "when": { "west": true }, + "apply": { "model": "biomesoplenty:bramble_plant_side", "y": 270, "uvlock": true } + }, + { "when": { "up": true }, + "apply": { "model": "biomesoplenty:bramble_plant_side", "x": 270, "uvlock": true } + }, + { "when": { "down": true }, + "apply": { "model": "biomesoplenty:bramble_plant_side", "x": 90, "uvlock": true } + } + ] +} diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index 32c0a276e..e0212cce6 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -139,6 +139,7 @@ tile.ash_block.name=Ash Block tile.bamboo.name=Bamboo tile.bamboo_thatching.name=Bamboo Thatching tile.biome_block.name=Biome Essence Ore +tile.bramble_plant.name=Bramble tile.cherry_fence.name=Cherry Fence tile.cherry_fence_gate.name=Cherry Fence Gate tile.cherry_wood_slab.name=Cherry Wood Slab diff --git a/src/main/resources/assets/biomesoplenty/models/block/bramble_plant.json b/src/main/resources/assets/biomesoplenty/models/block/bramble_plant.json new file mode 100644 index 000000000..41834198c --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/bramble_plant.json @@ -0,0 +1,39 @@ +{ "parent": "block/block", + "ambientocclusion": false, + "textures": { + "plant": "biomesoplenty:blocks/bramble_plant", + "thorns": "biomesoplenty:blocks/bramble_thorns", + "particle": "biomesoplenty:blocks/bramble_plant" + }, + "elements": [ + { "from": [ 0.8, 0, 8 ], + "to": [ 15.2, 16, 8 ], + "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 45, "rescale": true }, + "shade": false, + "faces": { + "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#thorns" }, + "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#thorns" } + } + }, + { "from": [ 8, 0, 0.8 ], + "to": [ 8, 16, 15.2 ], + "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 45, "rescale": true }, + "shade": false, + "faces": { + "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#thorns" }, + "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#thorns" } + } + }, + { "from": [ 4, 4, 4 ], + "to": [ 12, 12, 12 ], + "faces": { + "down": { "uv": [ 12, 12, 4, 4 ], "texture": "#plant" }, + "up": { "uv": [ 4, 4, 12, 12 ], "texture": "#plant" }, + "north": { "uv": [ 4, 4, 12, 12 ], "texture": "#plant" }, + "south": { "uv": [ 4, 4, 12, 12 ], "texture": "#plant" }, + "west": { "uv": [ 4, 4, 12, 12 ], "texture": "#plant" }, + "east": { "uv": [ 4, 4, 12, 12 ], "texture": "#plant" } + } + } + ] +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/bramble_plant_side.json b/src/main/resources/assets/biomesoplenty/models/block/bramble_plant_side.json new file mode 100644 index 000000000..312fd37fe --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/bramble_plant_side.json @@ -0,0 +1,19 @@ +{ + "ambientocclusion": false, + "textures": { + "texture": "biomesoplenty:blocks/bramble_plant", + "particle": "biomesoplenty:blocks/bramble_plant" + }, + "elements": [ + { "from": [ 4, 4, 0 ], + "to": [ 12, 12, 4 ], + "faces": { + "down": { "texture": "#texture" }, + "up": { "texture": "#texture" }, + "north": { "texture": "#texture", "cullface":"north" }, + "west": { "texture": "#texture" }, + "east": { "texture": "#texture" } + } + } + ] +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/bramble_plant.json b/src/main/resources/assets/biomesoplenty/models/item/bramble_plant.json new file mode 100644 index 000000000..c32f38e49 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/bramble_plant.json @@ -0,0 +1,3 @@ +{ + "parent": "biomesoplenty:block/bramble_plant" +} diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/bramble_plant.png b/src/main/resources/assets/biomesoplenty/textures/blocks/bramble_plant.png new file mode 100644 index 000000000..f65c4322d Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/bramble_plant.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/bramble_thorns.png b/src/main/resources/assets/biomesoplenty/textures/blocks/bramble_thorns.png new file mode 100644 index 000000000..d24ed2217 Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/bramble_thorns.png differ