add compatibility for 1.22 bushes to be treated as flowers
This commit is contained in:
@@ -15,9 +15,23 @@ public static class PlantRecognitionUtilities
|
||||
|
||||
public static bool IsFlower(Block block, IBlockAccessor accessor, BlockPos pos)
|
||||
{
|
||||
if (block.FirstCodePart() == "flower")
|
||||
var code = block.FirstCodePart();
|
||||
if (code == "flower")
|
||||
return true;
|
||||
|
||||
if (code == "fruitingbush")
|
||||
{
|
||||
var blockEntity = accessor.GetBlockEntity(pos);
|
||||
if (blockEntity is null)
|
||||
return false;
|
||||
|
||||
foreach (var behavior in blockEntity.Behaviors)
|
||||
{
|
||||
if (behavior.IsFruitingBushFlowering())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (block is BlockPlantContainer)
|
||||
{
|
||||
var plantContainer = block.GetBlockEntity<BlockEntityPlantContainer?>(pos);
|
||||
|
||||
Reference in New Issue
Block a user