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/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/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 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: 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