Fix inconsistency in placement of regular and tall cattail - both now require water
This commit is contained in:
parent
e6b8d04fb0
commit
43c2d300fb
|
@ -13,6 +13,7 @@ import java.util.Random;
|
||||||
|
|
||||||
import biomesoplenty.api.block.BOPBlocks;
|
import biomesoplenty.api.block.BOPBlocks;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.BlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
|
@ -164,25 +165,37 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlockStay(World world, BlockPos lowerPos, IBlockState state)
|
public boolean canBlockStay(World world, BlockPos lowerPos, IBlockState state)
|
||||||
{
|
{
|
||||||
|
DoublePlantType plant = ((DoublePlantType) state.getValue(VARIANT));
|
||||||
IBlockState groundState = world.getBlockState(lowerPos.down());
|
IBlockState groundState = world.getBlockState(lowerPos.down());
|
||||||
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);
|
||||||
if (groundBlock instanceof BlockBOPGrass)
|
if (groundBlock instanceof BlockBOPGrass)
|
||||||
{
|
{
|
||||||
switch ((BlockBOPGrass.BOPGrassType) groundState.getValue(BlockBOPGrass.VARIANT))
|
switch ((BlockBOPGrass.BOPGrassType) groundState.getValue(BlockBOPGrass.VARIANT))
|
||||||
{
|
{
|
||||||
case SPECTRAL_MOSS: case SMOLDERING:
|
case SPECTRAL_MOSS: case SMOLDERING:
|
||||||
break;
|
break;
|
||||||
case OVERGROWN_NETHERRACK: case LOAMY: case SANDY: case SILTY: case ORIGIN: default:
|
case OVERGROWN_NETHERRACK:
|
||||||
onFertile = true;
|
onFertile = true;
|
||||||
break;
|
break;
|
||||||
|
case LOAMY: case SANDY: case SILTY: case ORIGIN: default:
|
||||||
|
onFertile = true;
|
||||||
|
onGrass = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return onFertile;
|
switch (plant)
|
||||||
|
{
|
||||||
|
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 FLAX: default:
|
||||||
|
return onFertile;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue