Add cattail
This commit is contained in:
parent
591bdebe5e
commit
41f28506e1
9 changed files with 51 additions and 8 deletions
|
@ -38,7 +38,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
|||
// add properties (note we inherit HALF from BlockDoubleDecoration)
|
||||
public static enum DoublePlantType implements IStringSerializable
|
||||
{
|
||||
FLAX, TALL_CATTAIL;
|
||||
FLAX, TALL_CATTAIL, EYEBULB;
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
|
@ -156,10 +156,11 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
|||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
boolean isLower = ((Half) worldIn.getBlockState(pos).getValue(HALF) == Half.LOWER);
|
||||
switch ((DoublePlantType) worldIn.getBlockState(pos).getValue(VARIANT))
|
||||
{
|
||||
default:
|
||||
this.setBlockBoundsByRadiusAndHeight(0.4F, 0.8F);
|
||||
this.setBlockBoundsByRadiusAndHeightWithXZOffset(0.4F, isLower ? 1.0F : 0.8F, pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -173,6 +174,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
|||
Block groundBlock = groundState.getBlock();
|
||||
boolean onFertile = (groundBlock == Blocks.dirt || groundBlock == BOPBlocks.dirt || groundBlock == Blocks.mycelium || groundBlock == Blocks.grass);
|
||||
boolean onGrass = (groundBlock == Blocks.grass);
|
||||
boolean onHellish = (groundBlock == Blocks.netherrack || groundBlock == BOPBlocks.flesh);
|
||||
if (groundBlock instanceof BlockBOPGrass)
|
||||
{
|
||||
switch ((BlockBOPGrass.BOPGrassType) groundState.getValue(BlockBOPGrass.VARIANT))
|
||||
|
@ -181,6 +183,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
|||
break;
|
||||
case OVERGROWN_NETHERRACK:
|
||||
onFertile = true;
|
||||
onHellish = true;
|
||||
break;
|
||||
case LOAMY: case SANDY: case SILTY: case ORIGIN: default:
|
||||
onFertile = true;
|
||||
|
@ -193,6 +196,8 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
|||
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);
|
||||
return onGrass && hasWater;
|
||||
case EYEBULB:
|
||||
return onHellish;
|
||||
case FLAX: default:
|
||||
return onFertile;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -55,7 +56,6 @@ public class BlockDecoration extends Block implements IBOPBlock
|
|||
this.setTickRandomly(true);
|
||||
this.setHardness(0.0F);
|
||||
this.setStepSound(Block.soundTypeGrass);
|
||||
this.setBlockBoundsByRadiusAndHeight(0.3F, 0.6F);
|
||||
|
||||
this.setDefaultState(this.blockState.getBaseState());
|
||||
}
|
||||
|
@ -169,5 +169,11 @@ public class BlockDecoration extends Block implements IBOPBlock
|
|||
return Block.EnumOffsetType.XZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) {
|
||||
this.setBlockBoundsByRadiusAndHeightWithXZOffset(0.3F, 0.6F, pos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -175,10 +175,10 @@ public class BlockDoubleDecoration extends BlockDecoration {
|
|||
switch ((Half) state.getValue(HALF))
|
||||
{
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
"half=upper,variant=flax": { "model": "biomesoplenty:flax_upper" },
|
||||
"half=lower,variant=flax": { "model": "biomesoplenty:flax_lower" },
|
||||
"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" }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cross",
|
||||
"textures": {
|
||||
"cross": "biomesoplenty:blocks/eyebulb_lower"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cross",
|
||||
"textures": {
|
||||
"cross": "biomesoplenty:blocks/eyebulb_upper"
|
||||
}
|
||||
}
|
|
@ -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 |
Loading…
Reference in a new issue