This commit is contained in:
2026-11-22 13:21:27 -03:00
parent e751d22c6e
commit ac791b886e
23 changed files with 494 additions and 91 deletions
+12 -3
View File
@@ -381,6 +381,13 @@ export interface BlockInteractEvent {
readonly item: ItemStack | undefined;
}
// a right click on an entity, like neoforge's PlayerInteractEvent.EntityInteract
export interface EntityInteractEvent {
readonly player: Player;
readonly entity: EntityRef;
readonly item: ItemStack | undefined;
}
// a player or a mob being hurt, like neoforge's LivingIncomingDamageEvent
export interface EntityDamageEvent {
readonly entity: LivingRef;
@@ -408,6 +415,8 @@ export interface ServerBeforeEvents {
block_break: EventSignal<BlockBreakEvent & Cancelable>;
block_place: EventSignal<BlockPlaceEvent & Cancelable>;
block_interact: EventSignal<BlockInteractEvent & Cancelable>;
// handlers do what the click does, and cancel it so the held item isn't used too
entity_interact: EventSignal<EntityInteractEvent & Cancelable>;
chat_send: EventSignal<ChatSendEvent & Cancelable>;
entity_damage: EventSignal<EntityDamageEvent & Cancelable>;
}
@@ -584,10 +593,10 @@ export interface EntityRef {
// like neoforge's Entity.kill: a player or a mob dies, even when invulnerable, and anything else is removed. cause
// is for events and the death message, like LivingRef.damage's. mods' entity_damage can still cancel it
kill(cause?: string): void;
// what an item lying around is, a copy. undefined for every other kind of entity
// what an item lying around is, or what an object holds, a copy. undefined for every other kind of entity
get_item(): ItemStack | undefined;
// changes what an item lying around is, like ItemEntity.setItem. undefined or a count of 0 removes it. throws for
// every other kind of entity
// changes what an item lying around is, like ItemEntity.setItem, undefined or a count of 0 removing it. or what an
// object holds, undefined or a count of 0 leaving it holding nothing. throws for every other kind of entity
set_item(item: ItemStack | undefined): void;
// a sound following it, once, for every player who sees it and is within its range
play_sound(sound: Id, options?: PlayOptions): void;