Remove useless effects for now
This commit is contained in:
@@ -28,8 +28,6 @@ const SWIM_UP = 0.04;
|
||||
// a jump can't start more often than this while jump is held
|
||||
const JUMP_DELAY = 10;
|
||||
const KNOCKBACK = 0.4;
|
||||
// gravity while slow falling, blocks per tick per tick
|
||||
const SLOW_FALL_GRAVITY = 0.01;
|
||||
|
||||
export interface SavedLivingEntity extends SavedEntity {
|
||||
health?: number;
|
||||
@@ -206,20 +204,14 @@ export abstract class LivingEntity extends Entity {
|
||||
server_ai_step() {}
|
||||
|
||||
jump_from_ground() {
|
||||
const boost = this.get_effect(EFFECTS.jump_boost);
|
||||
const power = this.attribute(ATTRIBUTES.jump_strength) + (boost ? 0.1 * (boost.amplifier + 1) : 0);
|
||||
this.vy = Math.max(power * TICKS_PER_SECOND, this.vy);
|
||||
this.vy = Math.max(this.attribute(ATTRIBUTES.jump_strength) * TICKS_PER_SECOND, this.vy);
|
||||
}
|
||||
|
||||
// minecraft's LivingEntity.travel: speeds up towards where forward and strafe point, grip depending on whether it's
|
||||
// on the ground, in the air or in water, then moves
|
||||
travel() {
|
||||
this.step_height = this.attribute(ATTRIBUTES.step_height);
|
||||
let gravity = this.attribute(ATTRIBUTES.gravity);
|
||||
if (this.vy <= 0 && this.has_effect(EFFECTS.slow_falling)) {
|
||||
gravity = Math.min(gravity, SLOW_FALL_GRAVITY);
|
||||
this.fall_distance = 0;
|
||||
}
|
||||
const gravity = this.attribute(ATTRIBUTES.gravity);
|
||||
|
||||
if (this.in_water) {
|
||||
this.gravity = -gravity / 16 * TICKS_PER_SECOND ** 2;
|
||||
@@ -272,10 +264,6 @@ export abstract class LivingEntity extends Entity {
|
||||
|
||||
// health
|
||||
|
||||
override is_invulnerable_to(source: DamageSource) {
|
||||
return super.is_invulnerable_to(source) || (source.fire === true && this.has_effect(EFFECTS.fire_resistance));
|
||||
}
|
||||
|
||||
// like minecraft's LivingEntity.hurt. returns whether it was hurt
|
||||
override hurt(amount: number, source: DamageSource): boolean {
|
||||
if (this.is_invulnerable_to(source) || this.dead || !(amount > 0)) {
|
||||
@@ -499,7 +487,6 @@ export abstract class LivingEntity extends Entity {
|
||||
|
||||
override synced_data(): EntityData {
|
||||
const data = super.synced_data();
|
||||
if (this.has_effect(EFFECTS.glowing)) data.glowing = true;
|
||||
if (this.equipment.size) {
|
||||
data.equipment = Object.fromEntries(
|
||||
[...this.equipment].map(([slot, stack]) => [slot, stack.to_synced_data()]),
|
||||
|
||||
Reference in New Issue
Block a user