Creative
This commit is contained in:
@@ -126,6 +126,8 @@ export class LocalPlayer extends Player {
|
||||
sprinting = false;
|
||||
// what the server says, see /fly
|
||||
flying = false;
|
||||
// what the server says, see /creative
|
||||
creative = false;
|
||||
#fov_scale = 1;
|
||||
#prev_fov_scale = 1;
|
||||
#prev_eye_height = PLAYER_EYE_HEIGHT;
|
||||
|
||||
+6
-3
@@ -45,7 +45,8 @@ export class MultiPlayerGameMode {
|
||||
this.destroy_progress = 0;
|
||||
}
|
||||
this.destroy_pos = { x: hit.x, y: hit.y, z: hit.z };
|
||||
this.destroy_time = block_info.toughness ?? 9999;
|
||||
// blocks without a toughness, like water, can only be broken in creative
|
||||
this.destroy_time = this.client.player.creative ? 0 : block_info.toughness ?? 9999;
|
||||
this.destroy_progress += TICK_DELTA * (tool && tool.type === block_info.tool_to_break ? tool.speed : 1);
|
||||
|
||||
if (this.destroy_progress >= this.destroy_time) {
|
||||
@@ -134,8 +135,10 @@ export class MultiPlayerGameMode {
|
||||
if ((!block_info.interactive || skips_block) && place_id && placeable) {
|
||||
level.add_block({ ...target, id: place_id }, place_value! >>> 16);
|
||||
predict_neighbors(target.x, target.y, target.z);
|
||||
const slot = this.#held_slot();
|
||||
slot.amount = slot.amount! - 1;
|
||||
if (!this.client.player.creative) {
|
||||
const slot = this.#held_slot();
|
||||
slot.amount = slot.amount! - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,9 @@ export class ClientPacketListener {
|
||||
case "flying":
|
||||
client.player.flying = message.flying;
|
||||
break;
|
||||
case "creative":
|
||||
client.player.creative = message.creative;
|
||||
break;
|
||||
case "effects":
|
||||
client.player.effects = message.effects;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user