mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-24 17:39:30 +00:00
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -150,4 +150,4 @@ blocks:
|
||||
- type: damage
|
||||
target: self
|
||||
amount: 1.0
|
||||
damage-type: lava
|
||||
damage-type: on_fire
|
||||
@@ -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
|
||||
|
||||
@@ -18,6 +18,7 @@ items:
|
||||
map-color: 11
|
||||
push-reaction: destroy
|
||||
behaviors:
|
||||
- type: liquid_flowable_block
|
||||
- type: sturdy_base_block
|
||||
direction: down
|
||||
support-types:
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class DamageFunction<CTX extends Context> 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
|
||||
|
||||
Reference in New Issue
Block a user