From 1e043af154d808cb4c6b16e8b2987fbd106a1369 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 25 May 2023 13:10:18 +0100 Subject: [PATCH] Palm trees are recognised as trees by the buck ability now --- .../unicopia/ability/EarthPonyKickAbility.java | 8 ++++++-- .../unicopia/ability/data/tree/TreeType.java | 4 +++- src/main/resources/data/unicopia/tree_types/palm.json | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/data/unicopia/tree_types/palm.json diff --git a/src/main/java/com/minelittlepony/unicopia/ability/EarthPonyKickAbility.java b/src/main/java/com/minelittlepony/unicopia/ability/EarthPonyKickAbility.java index b062b6c5..e01a859c 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/EarthPonyKickAbility.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/EarthPonyKickAbility.java @@ -156,10 +156,10 @@ public class EarthPonyKickAbility implements Ability { if (tree == TreeType.NONE) { return; - } else { - ParticleUtils.spawnParticle(iplayer.asWorld(), UParticles.GROUND_POUND, data.vec(), Vec3d.ZERO); } + ParticleUtils.spawnParticle(iplayer.asWorld(), UParticles.GROUND_POUND, data.vec(), Vec3d.ZERO); + PlayerEntity player = iplayer.asEntity(); if (BlockDestructionManager.of(player.world).getBlockDestruction(pos) + 4 >= BlockDestructionManager.MAX_DAMAGE) { @@ -245,6 +245,10 @@ public class EarthPonyKickAbility implements Ability { return Stream.of(tree.pickRandomStack(world.random, treeState)); } + if (below.getBlock() instanceof Buckable buckable) { + return buckable.onBucked((ServerWorld)world, below, down).stream(); + } + return Stream.empty(); } diff --git a/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeType.java b/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeType.java index 15b4adc9..bef0d6ce 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeType.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeType.java @@ -120,7 +120,9 @@ public interface TreeType { traverseInner(logs, leaves, w, findCanopy(w, pos), 0, 50, null, null); - return logCount <= (leaves.size() / 2) ? logCount + leaves.size() : 0; + int leafCount = leaves.size(); + + return logCount <= (leafCount / 2) ? logCount + leafCount : 0; } /** diff --git a/src/main/resources/data/unicopia/tree_types/palm.json b/src/main/resources/data/unicopia/tree_types/palm.json new file mode 100644 index 00000000..069e6e19 --- /dev/null +++ b/src/main/resources/data/unicopia/tree_types/palm.json @@ -0,0 +1,6 @@ +{ + "logs": [ "unicopia:palm_log", "unicopia:palm_wood" ], + "leaves": [ "unicopia:palm_leaves" ], + "wideTrunk": false, + "drops": [] +} \ No newline at end of file