Private
Public Access
1
0

add compatibility for 1.22 bushes to be treated as flowers

This commit is contained in:
2026-05-25 07:50:27 +02:00
parent b8e356cb23
commit d7ca3f8e99
3 changed files with 75 additions and 2 deletions

View File

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