Add cattail

This commit is contained in:
Cheeserolls 2015-05-23 19:40:16 +01:00
parent 591bdebe5e
commit 41f28506e1
9 changed files with 51 additions and 8 deletions

View file

@ -38,7 +38,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
// add properties (note we inherit HALF from BlockDoubleDecoration) // add properties (note we inherit HALF from BlockDoubleDecoration)
public static enum DoublePlantType implements IStringSerializable public static enum DoublePlantType implements IStringSerializable
{ {
FLAX, TALL_CATTAIL; FLAX, TALL_CATTAIL, EYEBULB;
@Override @Override
public String getName() public String getName()
{ {
@ -156,12 +156,13 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
@Override @Override
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{ {
boolean isLower = ((Half) worldIn.getBlockState(pos).getValue(HALF) == Half.LOWER);
switch ((DoublePlantType) worldIn.getBlockState(pos).getValue(VARIANT)) switch ((DoublePlantType) worldIn.getBlockState(pos).getValue(VARIANT))
{ {
default: default:
this.setBlockBoundsByRadiusAndHeight(0.4F, 0.8F); this.setBlockBoundsByRadiusAndHeightWithXZOffset(0.4F, isLower ? 1.0F : 0.8F, pos);
break; break;
} }
} }
@ -173,6 +174,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
Block groundBlock = groundState.getBlock(); Block groundBlock = groundState.getBlock();
boolean onFertile = (groundBlock == Blocks.dirt || groundBlock == BOPBlocks.dirt || groundBlock == Blocks.mycelium || groundBlock == Blocks.grass); boolean onFertile = (groundBlock == Blocks.dirt || groundBlock == BOPBlocks.dirt || groundBlock == Blocks.mycelium || groundBlock == Blocks.grass);
boolean onGrass = (groundBlock == Blocks.grass); boolean onGrass = (groundBlock == Blocks.grass);
boolean onHellish = (groundBlock == Blocks.netherrack || groundBlock == BOPBlocks.flesh);
if (groundBlock instanceof BlockBOPGrass) if (groundBlock instanceof BlockBOPGrass)
{ {
switch ((BlockBOPGrass.BOPGrassType) groundState.getValue(BlockBOPGrass.VARIANT)) switch ((BlockBOPGrass.BOPGrassType) groundState.getValue(BlockBOPGrass.VARIANT))
@ -181,6 +183,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
break; break;
case OVERGROWN_NETHERRACK: case OVERGROWN_NETHERRACK:
onFertile = true; onFertile = true;
onHellish = true;
break; break;
case LOAMY: case SANDY: case SILTY: case ORIGIN: default: case LOAMY: case SANDY: case SILTY: case ORIGIN: default:
onFertile = true; onFertile = true;
@ -193,9 +196,11 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
case TALL_CATTAIL: case TALL_CATTAIL:
boolean hasWater = (world.getBlockState(lowerPos.add(-1, -1, 0)).getBlock().getMaterial() == Material.water || world.getBlockState(lowerPos.add(1,-1,0)).getBlock().getMaterial() == Material.water || world.getBlockState(lowerPos.add(0,-1,-1)).getBlock().getMaterial() == Material.water || world.getBlockState(lowerPos.add(0,-1,1)).getBlock().getMaterial() == Material.water); boolean hasWater = (world.getBlockState(lowerPos.add(-1, -1, 0)).getBlock().getMaterial() == Material.water || world.getBlockState(lowerPos.add(1,-1,0)).getBlock().getMaterial() == Material.water || world.getBlockState(lowerPos.add(0,-1,-1)).getBlock().getMaterial() == Material.water || world.getBlockState(lowerPos.add(0,-1,1)).getBlock().getMaterial() == Material.water);
return onGrass && hasWater; return onGrass && hasWater;
case EYEBULB:
return onHellish;
case FLAX: default: case FLAX: default:
return onFertile; return onFertile;
} }
} }

View file

@ -21,6 +21,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -55,7 +56,6 @@ public class BlockDecoration extends Block implements IBOPBlock
this.setTickRandomly(true); this.setTickRandomly(true);
this.setHardness(0.0F); this.setHardness(0.0F);
this.setStepSound(Block.soundTypeGrass); this.setStepSound(Block.soundTypeGrass);
this.setBlockBoundsByRadiusAndHeight(0.3F, 0.6F);
this.setDefaultState(this.blockState.getBaseState()); this.setDefaultState(this.blockState.getBaseState());
} }
@ -169,5 +169,11 @@ public class BlockDecoration extends Block implements IBOPBlock
return Block.EnumOffsetType.XZ; return Block.EnumOffsetType.XZ;
} }
@Override
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) {
this.setBlockBoundsByRadiusAndHeightWithXZOffset(0.3F, 0.6F, pos);
}
} }

View file

@ -175,10 +175,10 @@ public class BlockDoubleDecoration extends BlockDecoration {
switch ((Half) state.getValue(HALF)) switch ((Half) state.getValue(HALF))
{ {
case LOWER: case LOWER:
super.setBlockBoundsByRadiusAndHeight(this.radius, this.fromTop ? this.height : 1.0F, this.fromTop); this.setBlockBoundsByRadiusAndHeightWithXZOffset(this.radius, this.fromTop ? this.height : 1.0F, this.fromTop, pos);
break; break;
case UPPER: case UPPER:
super.setBlockBoundsByRadiusAndHeight(this.radius, this.fromTop ? 1.0F : this.height, this.fromTop); this.setBlockBoundsByRadiusAndHeightWithXZOffset(this.radius, this.fromTop ? 1.0F : this.height, this.fromTop, pos);
break; break;
} }
} }

View file

@ -3,6 +3,8 @@
"half=upper,variant=flax": { "model": "biomesoplenty:flax_upper" }, "half=upper,variant=flax": { "model": "biomesoplenty:flax_upper" },
"half=lower,variant=flax": { "model": "biomesoplenty:flax_lower" }, "half=lower,variant=flax": { "model": "biomesoplenty:flax_lower" },
"half=upper,variant=tall_cattail": { "model": "biomesoplenty:tall_cattail_upper" }, "half=upper,variant=tall_cattail": { "model": "biomesoplenty:tall_cattail_upper" },
"half=lower,variant=tall_cattail": { "model": "biomesoplenty:tall_cattail_lower" } "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" }
} }
} }

View file

@ -0,0 +1,6 @@
{
"parent": "block/cross",
"textures": {
"cross": "biomesoplenty:blocks/eyebulb_lower"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/cross",
"textures": {
"cross": "biomesoplenty:blocks/eyebulb_upper"
}
}

View file

@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "biomesoplenty:blocks/eyebulb_upper"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B