From 26827af4941d3a59dd2695a65d10c51dd3a8605a Mon Sep 17 00:00:00 2001 From: jhqwqmc Date: Sun, 19 Oct 2025 20:21:23 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BC=A4=E5=AE=B3?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bukkit/plugin/user/BukkitServerPlayer.java | 10 ++++++++-- .../craftengine/core/entity/player/Player.java | 2 +- .../core/plugin/context/function/DamageFunction.java | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/user/BukkitServerPlayer.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/user/BukkitServerPlayer.java index 9130ac72b..c52b0397e 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/user/BukkitServerPlayer.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/user/BukkitServerPlayer.java @@ -49,6 +49,7 @@ import org.bukkit.attribute.AttributeInstance; import org.bukkit.block.Block; import org.bukkit.damage.DamageSource; import org.bukkit.damage.DamageType; +import org.bukkit.entity.Entity; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.inventory.EquipmentSlot; @@ -1151,10 +1152,15 @@ public class BukkitServerPlayer extends Player { } @Override - public void damage(double amount, Key damageType) { + public void damage(double amount, Key damageType, @Nullable Object causeEntity) { @SuppressWarnings("deprecation") DamageType type = Registry.DAMAGE_TYPE.get(KeyUtils.toNamespacedKey(damageType)); - this.platformPlayer().damage(amount, DamageSource.builder(type != null ? type : DamageType.GENERIC).build()); + DamageSource source = DamageSource.builder(type != null ? type : DamageType.GENERIC) + .withCausingEntity(causeEntity instanceof Entity entity ? entity : this.platformPlayer()) + .withDirectEntity(this.platformPlayer()) + .withDamageLocation(this.platformPlayer().getLocation()) + .build(); + this.platformPlayer().damage(amount, source); } @Override diff --git a/core/src/main/java/net/momirealms/craftengine/core/entity/player/Player.java b/core/src/main/java/net/momirealms/craftengine/core/entity/player/Player.java index 35bcb6305..82ad30715 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/entity/player/Player.java +++ b/core/src/main/java/net/momirealms/craftengine/core/entity/player/Player.java @@ -173,7 +173,7 @@ public abstract class Player extends AbstractEntity implements NetWorkUser { public abstract void teleport(WorldPosition worldPosition); - public abstract void damage(double amount, Key damageType); + public abstract void damage(double amount, Key damageType, @Nullable Object causeEntity); public abstract Locale locale(); diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/function/DamageFunction.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/function/DamageFunction.java index 8c75f6a53..97e197b55 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/function/DamageFunction.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/function/DamageFunction.java @@ -26,7 +26,7 @@ public class DamageFunction extends AbstractConditionalFunc @Override protected void runInternal(CTX ctx) { - selector.get(ctx).forEach(p -> p.damage(amount.getDouble(ctx), damageType)); + selector.get(ctx).forEach(p -> p.damage(amount.getDouble(ctx), damageType, null)); } @Override From 56db6a5262a07263ed916875f90dae6a7283e5df Mon Sep 17 00:00:00 2001 From: jhqwqmc Date: Sun, 19 Oct 2025 21:42:47 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D2=E4=B8=AA=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E7=9A=84=E6=96=B9=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/default/configuration/blocks/palm_tree.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common-files/src/main/resources/resources/default/configuration/blocks/palm_tree.yml b/common-files/src/main/resources/resources/default/configuration/blocks/palm_tree.yml index b7b048918..2d2a8ca3e 100644 --- a/common-files/src/main/resources/resources/default/configuration/blocks/palm_tree.yml +++ b/common-files/src/main/resources/resources/default/configuration/blocks/palm_tree.yml @@ -168,6 +168,7 @@ items: settings: template: default:settings/sapling behaviors: + - type: liquid_flowable_block - type: bush_block bottom-block-tags: - minecraft:dirt @@ -676,6 +677,7 @@ blocks#button: - minecraft:mineable/axe - minecraft:wooden_buttons behaviors: + - type: liquid_flowable_block - type: face_attached_horizontal_directional_block - type: button_block ticks-to-stay-pressed: 30 From be400709cdcb1e30bf1f4a1d3c6336eb00cfc41b Mon Sep 17 00:00:00 2001 From: jhqwqmc Date: Sun, 19 Oct 2025 21:59:58 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E6=96=B9=E5=9D=97=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/configuration/blocks/ender_pearl_flower.yml | 1 + .../default/configuration/blocks/fairy_flower.yml | 9 +++++---- .../default/configuration/blocks/hami_melon.yml | 2 ++ .../default/configuration/blocks/magma_plant.yml | 2 +- .../resources/default/configuration/blocks/pebble.yml | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common-files/src/main/resources/resources/default/configuration/blocks/ender_pearl_flower.yml b/common-files/src/main/resources/resources/default/configuration/blocks/ender_pearl_flower.yml index 0b61f7161..1966ea9b1 100644 --- a/common-files/src/main/resources/resources/default/configuration/blocks/ender_pearl_flower.yml +++ b/common-files/src/main/resources/resources/default/configuration/blocks/ender_pearl_flower.yml @@ -22,6 +22,7 @@ blocks: map-color: 24 is-randomly-ticking: true behaviors: + - type: liquid_flowable_block - type: bush_block bottom-blocks: - minecraft:end_stone diff --git a/common-files/src/main/resources/resources/default/configuration/blocks/fairy_flower.yml b/common-files/src/main/resources/resources/default/configuration/blocks/fairy_flower.yml index 52a2815fd..ef42b7638 100644 --- a/common-files/src/main/resources/resources/default/configuration/blocks/fairy_flower.yml +++ b/common-files/src/main/resources/resources/default/configuration/blocks/fairy_flower.yml @@ -19,10 +19,11 @@ items: push-reaction: destroy map-color: 19 behavior: - type: bush_block - bottom-block-tags: - - minecraft:dirt - - minecraft:farmland + - type: liquid_flowable_block + - type: bush_block + bottom-block-tags: + - minecraft:dirt + - minecraft:farmland loot: template: default:loot_table/self state: diff --git a/common-files/src/main/resources/resources/default/configuration/blocks/hami_melon.yml b/common-files/src/main/resources/resources/default/configuration/blocks/hami_melon.yml index 00cc12d7c..03592440a 100644 --- a/common-files/src/main/resources/resources/default/configuration/blocks/hami_melon.yml +++ b/common-files/src/main/resources/resources/default/configuration/blocks/hami_melon.yml @@ -108,6 +108,7 @@ blocks: - minecraft:crops - minecraft:maintains_farmland behaviors: + - type: liquid_flowable_block - type: stem_block fruit: default:hami_melon attached-stem: default:attached_hami_melon_stem @@ -169,6 +170,7 @@ blocks: tags: - minecraft:maintains_farmland behaviors: + - type: liquid_flowable_block - type: attached_stem_block fruit: default:hami_melon stem: default:hami_melon_stem diff --git a/common-files/src/main/resources/resources/default/configuration/blocks/magma_plant.yml b/common-files/src/main/resources/resources/default/configuration/blocks/magma_plant.yml index bb6b3cd31..6161f21e8 100644 --- a/common-files/src/main/resources/resources/default/configuration/blocks/magma_plant.yml +++ b/common-files/src/main/resources/resources/default/configuration/blocks/magma_plant.yml @@ -150,4 +150,4 @@ blocks: - type: damage target: self amount: 1.0 - damage-type: lava \ No newline at end of file + damage-type: on_fire \ No newline at end of file diff --git a/common-files/src/main/resources/resources/default/configuration/blocks/pebble.yml b/common-files/src/main/resources/resources/default/configuration/blocks/pebble.yml index 23fe24d71..6f267d5ad 100644 --- a/common-files/src/main/resources/resources/default/configuration/blocks/pebble.yml +++ b/common-files/src/main/resources/resources/default/configuration/blocks/pebble.yml @@ -18,6 +18,7 @@ items: map-color: 11 push-reaction: destroy behaviors: + - type: liquid_flowable_block - type: sturdy_base_block direction: down support-types: