First Checkup

This commit is contained in:
Corail31
2018-02-11 22:51:13 +01:00
parent 7f7605c089
commit d0fda72a59
86 changed files with 429 additions and 428 deletions
@@ -30,8 +30,8 @@ public class EntityShield extends Entity {
this.height = 1.4f;
this.player = new WeakReference<EntityPlayer>(player);
this.noClip = true;
this.setPositionAndRotation(player.posX + player.getLookVec().xCoord,
player.posY + 1 + player.getLookVec().yCoord, player.posZ + player.getLookVec().zCoord,
this.setPositionAndRotation(player.posX + player.getLookVec().x,
player.posY + 1 + player.getLookVec().y, player.posZ + player.getLookVec().z,
player.rotationYawHead, player.rotationPitch);
this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.6f, this.posY - 0.7f, this.posZ - 0.6f,
this.posX + 0.6f, this.posY + 0.7f, this.posZ + 0.6f));
@@ -42,11 +42,11 @@ public class EntityShield extends Entity {
// System.out.println("Shield exists, ID: " + this.getUniqueID().toString());
EntityPlayer entityplayer = player != null ? player.get() : null;
if(entityplayer != null){
this.setPositionAndRotation(entityplayer.posX + entityplayer.getLookVec().xCoord * 0.3,
entityplayer.posY + 1 + entityplayer.getLookVec().yCoord * 0.3,
entityplayer.posZ + entityplayer.getLookVec().zCoord * 0.3, entityplayer.rotationYawHead,
this.setPositionAndRotation(entityplayer.posX + entityplayer.getLookVec().x * 0.3,
entityplayer.posY + 1 + entityplayer.getLookVec().y * 0.3,
entityplayer.posZ + entityplayer.getLookVec().z * 0.3, entityplayer.rotationYawHead,
entityplayer.rotationPitch);
if(!entityplayer.isHandActive() || entityplayer.getHeldItem(entityplayer.getActiveHand()) == null
if(!entityplayer.isHandActive() || entityplayer.getHeldItem(entityplayer.getActiveHand()).isEmpty()
|| !(entityplayer.getHeldItem(entityplayer.getActiveHand()).getItem() instanceof ItemWand)){
WizardData.get(entityplayer).shield = null;
this.setDead();
@@ -64,8 +64,8 @@ public class EntityShield extends Entity {
}
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2){
if(par1DamageSource != null && par1DamageSource.getSourceOfDamage() instanceof IProjectile){
par1DamageSource.getSourceOfDamage().playSound(WizardrySounds.SPELL_DEFLECTION, 0.3f, 1.3f);
if(par1DamageSource != null && par1DamageSource.getImmediateSource() instanceof IProjectile){
par1DamageSource.getImmediateSource().playSound(WizardrySounds.SPELL_DEFLECTION, 0.3f, 1.3f);
}
super.attackEntityFrom(par1DamageSource, par2);
return false;
@@ -77,9 +77,9 @@ public class EntityForcefield extends EntityMagicConstruct {
public boolean attackEntityFrom(DamageSource source, float par2){
if(source != null && source.getSourceOfDamage() != null){
if(source != null && source.getImmediateSource() != null){
// Now works for any source of damage.
source.getSourceOfDamage().playSound(WizardrySounds.SPELL_DEFLECTION, 0.3f, 1.3f);
source.getImmediateSource().playSound(WizardrySounds.SPELL_DEFLECTION, 0.3f, 1.3f);
}
super.attackEntityFrom(source, par2);
return false;
@@ -98,7 +98,7 @@ public class EntityAIAttackSpell extends EntityAIBase {
}
@Override
public boolean continueExecuting(){
public boolean shouldContinueExecuting(){
return this.shouldExecute() || !this.attacker.getNavigator().noPath();
}
@@ -322,8 +322,8 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity
public void onDeath(DamageSource source){
super.onDeath(source);
if(source.getEntity() instanceof EntityPlayer){
((EntityPlayer)source.getEntity()).addStat(WizardryAchievements.defeat_evil_wizard);
if(source.getTrueSource() instanceof EntityPlayer){
((EntityPlayer)source.getTrueSource()).addStat(WizardryAchievements.defeat_evil_wizard);
}
}
@@ -168,8 +168,8 @@ public class EntityIceGiant extends EntityIronGolem implements ISummonedCreature
public void onSuccessfulAttack(EntityLivingBase target){
target.motionY += 0.2;
target.motionX += this.getLookVec().xCoord * 0.2;
target.motionZ += this.getLookVec().xCoord * 0.2;
target.motionX += this.getLookVec().x * 0.2;
target.motionZ += this.getLookVec().x * 0.2;
target.addPotionEffect(new PotionEffect(WizardryPotions.frost, 300, 0));
@@ -125,7 +125,7 @@ public class EntityIceWraith extends EntityBlazeMinion {
this.motionZ = 0.0D;
}
this.world.theProfiler.startSection("ai");
this.world.profiler.startSection("ai");
if(this.isMovementBlocked()){
this.isJumping = false;
@@ -133,13 +133,13 @@ public class EntityIceWraith extends EntityBlazeMinion {
this.moveForward = 0.0F;
this.randomYawVelocity = 0.0F;
}else if(this.isServerWorld()){
this.world.theProfiler.startSection("newAi");
this.world.profiler.startSection("newAi");
this.updateEntityActionState();
this.world.theProfiler.endSection();
this.world.profiler.endSection();
}
this.world.theProfiler.endSection();
this.world.theProfiler.startSection("jump");
this.world.profiler.endSection();
this.world.profiler.startSection("jump");
if(this.isJumping){
if(this.isInWater()){
@@ -154,16 +154,16 @@ public class EntityIceWraith extends EntityBlazeMinion {
this.jumpTicks = 0;
}
this.world.theProfiler.endSection();
this.world.theProfiler.startSection("travel");
this.world.profiler.endSection();
this.world.profiler.startSection("travel");
this.moveStrafing *= 0.98F;
this.moveForward *= 0.98F;
this.randomYawVelocity *= 0.9F;
this.moveEntityWithHeading(this.moveStrafing, this.moveForward);
this.world.theProfiler.endSection();
this.world.theProfiler.startSection("push");
this.world.profiler.endSection();
this.world.profiler.startSection("push");
this.collideWithNearbyEntities();
this.world.theProfiler.endSection();
this.world.profiler.endSection();
}
@Override
@@ -123,7 +123,7 @@ public class EntitySkeletonMinion extends EntitySkeleton implements ISummonedCre
}
// Halloween pumpkin heads! Why not?
if(this.getItemStackFromSlot(EntityEquipmentSlot.HEAD) == null){
if(this.getItemStackFromSlot(EntityEquipmentSlot.HEAD).isEmpty()){
Calendar calendar = this.world.getCurrentDate();
if(calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.rand.nextFloat() < 0.25F){
@@ -125,7 +125,7 @@ public class EntityWitherSkeletonMinion extends EntityWitherSkeleton implements
}
// Halloween pumpkin heads! Why not?
if(this.getItemStackFromSlot(EntityEquipmentSlot.HEAD) == null){
if(this.getItemStackFromSlot(EntityEquipmentSlot.HEAD).isEmpty()){
Calendar calendar = this.world.getCurrentDate();
if(calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.rand.nextFloat() < 0.25F){
@@ -774,8 +774,8 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
@Override
public boolean attackEntityFrom(DamageSource source, float damage){
if(source.getEntity() instanceof EntityPlayer){
((EntityPlayer)source.getEntity()).addStat(WizardryAchievements.anger_wizard);
if(source.getTrueSource() instanceof EntityPlayer){
((EntityPlayer)source.getTrueSource()).addStat(WizardryAchievements.anger_wizard);
}
return super.attackEntityFrom(source, damage);
@@ -330,9 +330,9 @@ public interface ISummonedCreature extends IEntityAdditionalSpawnData {
// Rather than bother overriding entire attack methods in ISummonedCreature implementations, it's easier (and
// more robust) to use LivingAttackEvent to modify the damage source.
if(event.getSource().getEntity() instanceof ISummonedCreature){
if(event.getSource().getTrueSource() instanceof ISummonedCreature){
EntityLivingBase summoner = ((ISummonedCreature)event.getSource().getEntity()).getCaster();
EntityLivingBase summoner = ((ISummonedCreature)event.getSource().getTrueSource()).getCaster();
if(summoner != null){
@@ -349,11 +349,11 @@ public interface ISummonedCreature extends IEntityAdditionalSpawnData {
// All summoned creatures are classified as magic, so it makes sense to do it this way.
if(event.getSource() instanceof EntityDamageSourceIndirect){
newSource = new IndirectMinionDamage(event.getSource().damageType,
event.getSource().getSourceOfDamage(), event.getSource().getEntity(), summoner, type,
event.getSource().getImmediateSource(), event.getSource().getTrueSource(), summoner, type,
isRetaliatory);
}else if(event.getSource() instanceof EntityDamageSource){
// Name is copied over so it uses the appropriate vanilla death message
newSource = new MinionDamage(event.getSource().damageType, event.getSource().getEntity(), summoner,
newSource = new MinionDamage(event.getSource().damageType, event.getSource().getTrueSource(), summoner,
type, isRetaliatory);
}
@@ -365,8 +365,8 @@ public interface ISummonedCreature extends IEntityAdditionalSpawnData {
// For some reason Minecraft calculates knockback relative to DamageSource#getEntity. In vanilla this
// is unnoticeable, but it looks a bit weird with summoned creatures involved - so this fixes that.
if(WizardryUtilities.attackEntityWithoutKnockback(event.getEntity(), newSource, event.getAmount())){
WizardryUtilities.applyStandardKnockback(event.getSource().getEntity(), event.getEntityLiving());
((ISummonedCreature)event.getSource().getEntity()).onSuccessfulAttack(event.getEntityLiving());
WizardryUtilities.applyStandardKnockback(event.getSource().getTrueSource(), event.getEntityLiving());
((ISummonedCreature)event.getSource().getTrueSource()).onSuccessfulAttack(event.getEntityLiving());
}
}
@@ -277,7 +277,7 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
AxisAlignedBB axisalignedbb = iblockstate.getCollisionBoundingBox(this.world, blockpos);
if(axisalignedbb != Block.NULL_AABB
&& axisalignedbb.offset(blockpos).isVecInside(new Vec3d(this.posX, this.posY, this.posZ))){
&& axisalignedbb.offset(blockpos).contains(new Vec3d(this.posX, this.posY, this.posZ))){
this.inGround = true;
}
}
@@ -305,13 +305,13 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
vec3d = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if(raytraceresult != null){
vec3d = new Vec3d(raytraceresult.hitVec.xCoord, raytraceresult.hitVec.yCoord,
raytraceresult.hitVec.zCoord);
vec3d = new Vec3d(raytraceresult.hitVec.x, raytraceresult.hitVec.y,
raytraceresult.hitVec.z);
}
Entity entity = null;
List<?> list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox()
.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
.expand(this.motionX, this.motionY, this.motionZ).grow(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
int i;
float f1;
@@ -321,7 +321,7 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
if(entity1.canBeCollidedWith() && (entity1 != this.getShootingEntity() || this.ticksInAir >= 5)){
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.getEntityBoundingBox().expand((double)f1, (double)f1,
AxisAlignedBB axisalignedbb1 = entity1.getEntityBoundingBox().grow((double)f1, (double)f1,
(double)f1);
RayTraceResult RayTraceResult1 = axisalignedbb1.calculateIntercept(vec3d1, vec3d);
@@ -418,9 +418,9 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
this.blockY = raytraceresult.getBlockPos().getY();
this.blockZ = raytraceresult.getBlockPos().getZ();
this.stuckInBlock = this.world.getBlockState(raytraceresult.getBlockPos());
this.motionX = (double)((float)(raytraceresult.hitVec.xCoord - this.posX));
this.motionY = (double)((float)(raytraceresult.hitVec.yCoord - this.posY));
this.motionZ = (double)((float)(raytraceresult.hitVec.zCoord - this.posZ));
this.motionX = (double)((float)(raytraceresult.hitVec.x - this.posX));
this.motionY = (double)((float)(raytraceresult.hitVec.y - this.posY));
this.motionZ = (double)((float)(raytraceresult.hitVec.z - this.posZ));
// f2 = MathHelper.sqrt(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ *
// this.motionZ);
// this.posX -= this.motionX / (double)f2 * 0.05000000074505806D;