Finished up single coral

This commit is contained in:
Adubbz 2015-01-15 06:48:46 +11:00
parent 1847f46548
commit 13e7eee062
2 changed files with 39 additions and 6 deletions

View File

@ -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,

View File

@ -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