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
+6 -3
View File
@@ -318,7 +318,7 @@ export class Client {
player.entity_interaction_range,
(entity) =>
entity instanceof RemotePlayer ||
(entity instanceof RemoteEntity && !entity.dead && is_hittable(entity)),
(entity instanceof RemoteEntity && !entity.dead && is_pickable(entity)),
);
// a block in front of the entity hides it
this.hit_result = this.level.pick(
@@ -377,6 +377,8 @@ export class Client {
if (!attacking && using) {
this.game_mode.use_item_on(hit);
}
} else if (use_pressed && this.entity_hit) {
this.game_mode.interact(this.entity_hit);
} else if (use_pressed) {
this.game_mode.use_item();
} else if (!this.entity_hit && InputManager.is_mouse_pressed(0)) {
@@ -413,7 +415,8 @@ export class Client {
}
}
// mobs can be hit, scripted entities like the fishing hook can't. kinds the client doesn't know are left to the server
function is_hittable(entity: RemoteEntity) {
// what the crosshair can be on: mobs and objects, not scripted entities like the fishing hook. kinds the client doesn't
// know are left to the server
function is_pickable(entity: RemoteEntity) {
return EverythingRegistry.get<EntityJson>("entities", entity.type)?.behavior !== "scripted";
}