add vines

This commit is contained in:
okx-code
2025-08-29 02:56:18 +01:00
parent 345b24cfa6
commit 62f7c63fe3
2 changed files with 11 additions and 10 deletions

View File

@@ -56,10 +56,6 @@ public class BreakListener implements Listener {
event.getItemsHarvested().addAll(drops);
}
private boolean isSelfSeed(Material material) {
return RBUtils.getGrowthDirection(material) != BlockFace.SELF;
}
private boolean isFarmable(Material material) {
return material == Material.BEETROOTS || material == Material.WHEAT || material == Material.POTATOES || material == Material.CARROTS || material == Material.COCOA || material == Material.NETHER_WART;
}
@@ -67,14 +63,15 @@ public class BreakListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void on(BlockPlaceEvent event) {
Material type = event.getBlock().getType();
if (!isSelfSeed(type)) {
BlockFace direction = RBUtils.getGrowthDirection(type);
if (direction == BlockFace.SELF) {
return;
}
if (!breakManager.isControlledCrop(event.getBlock())) {
return;
}
if (type != event.getBlock().getRelative(RBUtils.getGrowthDirection(type).getOppositeFace()).getType()) {
if (type != event.getBlock().getRelative(direction.getOppositeFace()).getType()) {
return;
}
@@ -158,8 +155,9 @@ public class BreakListener implements Listener {
return;
}
if (isSelfSeed(type)) {
Block below = event.getBlock().getRelative(RBUtils.getGrowthDirection(type).getOppositeFace());
BlockFace direction = RBUtils.getGrowthDirection(type);
if (direction != BlockFace.SELF) {
Block below = event.getBlock().getRelative(direction.getOppositeFace());
if (!this.wasColumnLastTick.contains(below)) {
if (below.getType() != type && below.getType() != Material.AIR) {
// base blocks have normal drops
@@ -192,9 +190,10 @@ public class BreakListener implements Listener {
return;
}
if (isSelfSeed(block.getType())) {
BlockFace direction = RBUtils.getGrowthDirection(block.getType());
if (direction != BlockFace.SELF) {
this.wasColumnLastTick.add(event.getBlock());
if (event.getBlock().getType() != event.getBlock().getRelative(RBUtils.getGrowthDirection(event.getBlock().getType()).getOppositeFace()).getType()) {
if (event.getBlock().getType() != event.getBlock().getRelative(direction.getOppositeFace()).getType()) {
// base blocks have normal drops
return;
}

View File

@@ -41,6 +41,8 @@ public class BreakManager {
Map.entry(Material.JUNGLE_LEAVES, Material.JUNGLE_SAPLING),
Map.entry(Material.SWEET_BERRY_BUSH, Material.SWEET_BERRIES),
Map.entry(Material.CACTUS, Material.CACTUS),
Map.entry(Material.WEEPING_VINES_PLANT, Material.WEEPING_VINES),
Map.entry(Material.TWISTING_VINES_PLANT, Material.TWISTING_VINES),
Map.entry(Material.SUGAR_CANE, Material.SUGAR_CANE),
Map.entry(Material.BAMBOO, Material.BAMBOO),
Map.entry(Material.RED_MUSHROOM_BLOCK, Material.RED_MUSHROOM),