From 13e7eee06214ea92272475e6ddaed03c48d30697 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 15 Jan 2015 06:48:46 +1100 Subject: [PATCH] Finished up single coral --- .../common/block/BlockCoral.java | 34 ++++++++++++++++++- .../assets/biomesoplenty/lang/en_US.lang | 11 +++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/main/java/biomesoplenty/common/block/BlockCoral.java b/src/main/java/biomesoplenty/common/block/BlockCoral.java index b200dea87..2d011afff 100644 --- a/src/main/java/biomesoplenty/common/block/BlockCoral.java +++ b/src/main/java/biomesoplenty/common/block/BlockCoral.java @@ -9,14 +9,18 @@ package biomesoplenty.common.block; import static net.minecraft.block.BlockLiquid.LEVEL; - +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; import net.minecraft.util.IStringSerializable; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; import biomesoplenty.api.block.BOPPlant; public class BlockCoral extends BOPPlant @@ -28,7 +32,34 @@ public class BlockCoral extends BOPPlant super(Material.water); this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, CoralType.PINK)); + + this.setBlockBounds(0.1F, 0.0F, 0.1F, 0.9F, 0.8F, 0.9F); } + + @Override + public int getLightValue(IBlockAccess world, BlockPos pos) + { + IBlockState state = world.getBlockState(pos); + + if ((CoralType)state.getValue(VARIANT_PROP) == CoralType.GLOWING) + { + return 10; + } + + return super.getLightValue(); + } + + @Override + public boolean canBlockStay(World world, BlockPos pos, IBlockState state) + { + Block ground = world.getBlockState(pos.offsetDown()).getBlock(); + Block cover = world.getBlockState(pos.offsetUp()).getBlock(); + boolean hasWater = cover == Blocks.water || cover == Blocks.flowing_water; + + //TODO: Make all types depend on mud + return hasWater && + (ground == Blocks.dirt || ground == Blocks.sand || ground == Blocks.sponge || ground == Blocks.stone || ground == Blocks.clay || ground == Blocks.gravel || ground == Blocks.grass); + } @Override public IBlockState getStateFromMeta(int meta) @@ -70,6 +101,7 @@ public class BlockCoral extends BOPPlant return type.getName() + (fullName && type != CoralType.ALGAE ? "_coral" : ""); } + //TODO: Readd kelp public static enum CoralType implements IStringSerializable { PINK, diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index 23f82aae1..be206b14b 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -14,15 +14,16 @@ tile.bone_segment.large.name=Large Bone Segment tile.bopGrass.spectral_moss.name=Spectral Moss tile.bopGrass.smoldering_grass_block.name=Smoldering Grass Block +tile.coral.pink.name=Pink Coral +tile.coral.orange.name=Orange Coral +tile.coral.blue.name=Blue Coral +tile.coral.glowing.name=Glowing Coral +tile.coral.algae.name=Algae + tile.coral.kelp_bottom.name=Kelp Bottom tile.coral.kelp_middle.name=Kelp Middle tile.coral.kelp_top.name=Kelp Top tile.coral.kelp.name=Kelp -tile.coral.pink_coral.name=Pink Coral -tile.coral.orange_coral.name=Orange Coral -tile.coral.blue_coral.name=Blue Coral -tile.coral.glowing_coral.name=Glowing Coral -tile.coral.algae.name=Algae tile.flesh.name=Flesh