diff options
| author | mat <github@matdoes.dev> | 2022-12-08 18:39:35 -0600 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-12-08 18:39:35 -0600 |
| commit | 70e2dfed16da8d5130460ea15b47701e622f4a9f (patch) | |
| tree | 41f670baf3a05ed180880ec2a11d8e5f6a1a1599 /azalea-physics/src/collision/mod.rs | |
| parent | f2076daba5cfcce81399b075ba9258fbdc2012fa (diff) | |
| download | azalea-drasl-70e2dfed16da8d5130460ea15b47701e622f4a9f.tar.xz | |
wrap_comments = true
Diffstat (limited to 'azalea-physics/src/collision/mod.rs')
| -rw-r--r-- | azalea-physics/src/collision/mod.rs | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/azalea-physics/src/collision/mod.rs b/azalea-physics/src/collision/mod.rs index 7fb2cf97..c057f8d7 100644 --- a/azalea-physics/src/collision/mod.rs +++ b/azalea-physics/src/collision/mod.rs @@ -36,25 +36,29 @@ pub trait MovableEntity { impl HasCollision for World { // private Vec3 collide(Vec3 var1) { // AABB var2 = this.getBoundingBox(); - // List var3 = this.level.getEntityCollisions(this, var2.expandTowards(var1)); - // Vec3 var4 = var1.lengthSqr() == 0.0D ? var1 : collideBoundingBox(this, var1, var2, this.level, var3); + // List var3 = this.level.getEntityCollisions(this, + // var2.expandTowards(var1)); Vec3 var4 = var1.lengthSqr() == 0.0D ? + // var1 : collideBoundingBox(this, var1, var2, this.level, var3); // boolean var5 = var1.x != var4.x; // boolean var6 = var1.y != var4.y; // boolean var7 = var1.z != var4.z; // boolean var8 = this.onGround || var6 && var1.y < 0.0D; // if (this.maxUpStep > 0.0F && var8 && (var5 || var7)) { - // Vec3 var9 = collideBoundingBox(this, new Vec3(var1.x, (double)this.maxUpStep, var1.z), var2, this.level, var3); - // Vec3 var10 = collideBoundingBox(this, new Vec3(0.0D, (double)this.maxUpStep, 0.0D), var2.expandTowards(var1.x, 0.0D, var1.z), this.level, var3); + // Vec3 var9 = collideBoundingBox(this, new Vec3(var1.x, + // (double)this.maxUpStep, var1.z), var2, this.level, var3); Vec3 + // var10 = collideBoundingBox(this, new Vec3(0.0D, (double)this.maxUpStep, + // 0.0D), var2.expandTowards(var1.x, 0.0D, var1.z), this.level, var3); // if (var10.y < (double)this.maxUpStep) { - // Vec3 var11 = collideBoundingBox(this, new Vec3(var1.x, 0.0D, var1.z), var2.move(var10), this.level, var3).add(var10); - // if (var11.horizontalDistanceSqr() > var9.horizontalDistanceSqr()) { + // Vec3 var11 = collideBoundingBox(this, new Vec3(var1.x, 0.0D, + // var1.z), var2.move(var10), this.level, var3).add(var10); if + // (var11.horizontalDistanceSqr() > var9.horizontalDistanceSqr()) { // var9 = var11; // } // } // if (var9.horizontalDistanceSqr() > var4.horizontalDistanceSqr()) { - // return var9.add(collideBoundingBox(this, new Vec3(0.0D, -var9.y + var1.y, 0.0D), var2.move(var9), this.level, var3)); - // } + // return var9.add(collideBoundingBox(this, new Vec3(0.0D, -var9.y + + // var1.y, 0.0D), var2.move(var9), this.level, var3)); } // } // return var4; @@ -62,7 +66,8 @@ impl HasCollision for World { fn collide(&self, movement: &Vec3, entity: &EntityData) -> Vec3 { let entity_bounding_box = entity.bounding_box; // TODO: get_entity_collisions - // let entity_collisions = world.get_entity_collisions(self, entity_bounding_box.expand_towards(movement)); + // let entity_collisions = world.get_entity_collisions(self, + // entity_bounding_box.expand_towards(movement)); let entity_collisions = Vec::new(); if movement.length_sqr() == 0.0 { *movement @@ -144,7 +149,8 @@ impl<D: DerefMut<Target = World>> MovableEntity for Entity<'_, D> { // .get_block_state(&block_pos_below) // .expect("Couldn't get block state below"); - // self.check_fall_damage(collide_result.y, on_ground, block_state_below, block_pos_below); + // self.check_fall_damage(collide_result.y, on_ground, block_state_below, + // block_pos_below); // if self.isRemoved() { return; } @@ -159,12 +165,14 @@ impl<D: DerefMut<Target = World>> MovableEntity for Entity<'_, D> { if vertical_collision { // blockBelow.updateEntityAfterFallOn(this.level, this); - // the default implementation of updateEntityAfterFallOn sets the y movement to 0 + // the default implementation of updateEntityAfterFallOn sets the y movement to + // 0 self.delta.y = 0.; } if on_ground { - // blockBelow.stepOn(this.level, blockPosBelow, blockStateBelow, this); + // blockBelow.stepOn(this.level, blockPosBelow, blockStateBelow, + // this); } // sounds @@ -172,21 +180,22 @@ impl<D: DerefMut<Target = World>> MovableEntity for Entity<'_, D> { // this.tryCheckInsideBlocks(); // float var25 = this.getBlockSpeedFactor(); - // this.setDeltaMovement(this.getDeltaMovement().multiply((double)var25, 1.0D, (double)var25)); - // if (this.level.getBlockStatesIfLoaded(this.getBoundingBox().deflate(1.0E-6D)).noneMatch((var0) -> { + // this.setDeltaMovement(this.getDeltaMovement().multiply((double)var25, 1.0D, + // (double)var25)); if (this.level.getBlockStatesIfLoaded(this. + // getBoundingBox().deflate(1.0E-6D)).noneMatch((var0) -> { // return var0.is(BlockTags.FIRE) || var0.is(Blocks.LAVA); // })) { // if (this.remainingFireTicks <= 0) { // this.setRemainingFireTicks(-this.getFireImmuneTicks()); // } - // if (this.wasOnFire && (this.isInPowderSnow || this.isInWaterRainOrBubble())) { - // this.playEntityOnFireExtinguishedSound(); - // } + // if (this.wasOnFire && (this.isInPowderSnow || + // this.isInWaterRainOrBubble())) { this. + // playEntityOnFireExtinguishedSound(); } // } - // if (this.isOnFire() && (this.isInPowderSnow || this.isInWaterRainOrBubble())) { - // this.setRemainingFireTicks(-this.getFireImmuneTicks()); + // if (this.isOnFire() && (this.isInPowderSnow || this.isInWaterRainOrBubble())) + // { this.setRemainingFireTicks(-this.getFireImmuneTicks()); // } Ok(()) |
