Miscellaneous cleanup and commenting

This commit is contained in:
Electroblob
2018-06-24 16:08:28 +01:00
parent 76473f7185
commit 55ae4b1161
13 changed files with 35 additions and 14 deletions
@@ -15,7 +15,7 @@ public class EntityDart extends EntityMagicArrow {
super(world);
}
@Override public double getDamage(){ return 4.0d; }
@Override public double getDamage(){ return 4; }
@Override public boolean doGravity(){ return true; }
@@ -17,7 +17,7 @@ public class EntityIceShard extends EntityMagicArrow {
super(world);
}
@Override public double getDamage(){ return 6.0d; }
@Override public double getDamage(){ return 6; }
@Override public DamageType getDamageType(){ return DamageType.FROST; }
@@ -252,6 +252,9 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
this.ticksInGround = 0;
++this.ticksInAir;
// Does a ray trace to determine whether the projectile will hit a block in the next tick
Vec3d vec3d1 = new Vec3d(this.posX, this.posY, this.posZ);
Vec3d vec3d = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
RayTraceResult raytraceresult = this.world.rayTraceBlocks(vec3d1, vec3d, false, true, false);
@@ -262,6 +265,9 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
vec3d = new Vec3d(raytraceresult.hitVec.x, raytraceresult.hitVec.y,
raytraceresult.hitVec.z);
}
// Uses bounding boxes to determine whether the projectile will hit an entity in the next tick, and if so
// overwrites the block hit with an entity
Entity entity = null;
List<?> list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox()
@@ -13,7 +13,7 @@ public class EntityMagicMissile extends EntityMagicArrow {
super(world);
}
@Override public double getDamage(){ return 4.0d; }
@Override public double getDamage(){ return 4; }
@Override public boolean doGravity(){ return false; }
@@ -70,6 +70,7 @@ public abstract class EntityMagicProjectile extends EntityThrowable implements I
// Depends on the horizontal distance between the two entities and accounts for bullet drop,
// but of course if gravity is ignored this should be 0 since there is no bullet drop.
float bulletDropCompensation = !this.hasNoGravity() ? (float)horizontalDistance * 0.2f : 0;
// It turns out that this method normalises the input (x, y, z) anyway
this.shoot(dx, dy + (double)bulletDropCompensation, dz, speed, aimingError);
}
}