Zairus / HermitQuest

HermitQuest - Defeat all the hermits
0 stars 0 forks source link

Xbcrafted/Cubfan projectile causing crash. #5

Open HivemindJak opened 7 years ago

HivemindJak commented 7 years ago

cringe start First off, tiny typo: NTITIES_BOSS_XBCRAFTED not NTITIES_BOSS_XBCRADTED. cringe end Second there may be an issue with this section of the code. (please excuse my newbish tendencies)

Inside of EntityHermitBoss.java

Code line start: 552 if ( this.getDataManager().get(HERMIT_INDEX).intValue() == Hermits.XBCRAFTED.ordinal() || this.getDataManager().get(HERMIT_INDEX).intValue() == Hermits.CUBFAN135.ordinal()) { if (this.getDataManager().get(SHOOTING_TIME).intValue() > 0 && this.getTargetedEntity() != null) { EnumParticleTypes particle; SoundEvent sound;

            if (this.getDataManager().get(HERMIT_INDEX).intValue() == Hermits.XBCRAFTED.ordinal())
            {
                particle = EnumParticleTypes.WATER_BUBBLE;
                sound = SoundEvents.ENTITY_GUARDIAN_ATTACK;
            }
            else
            {
                particle = EnumParticleTypes.SMOKE_NORMAL;
                sound = SoundEvents.ENTITY_FIREWORK_LAUNCH;
            }

            Entity entity = this.getTargetedEntity();
            this.getLookHelper().setLookPositionWithEntity(entity, 90.0F, 90.0F);
            this.getLookHelper().onUpdateLook();
            double d5 = (double)((float)this.shootingTime / 120.0F);
            double d0 = entity.posX - this.posX;
            double d1 = entity.posY + (double)(entity.height * 0.5F) - (this.posY + (double)this.getEyeHeight());
            double d2 = entity.posZ - this.posZ;
            double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
            d0 = d0 / d3;
            d1 = d1 / d3;
            d2 = d2 / d3;
            double d4 = this.rand.nextDouble();

            this.playSound(sound, 1.0F, 1.0F);

            while (d4 < d3)
            {
                d4 += 1.8D - d5 + this.rand.nextDouble() * (1.7D - d5);

                this.worldObj.spawnParticle(
                        particle, 
                        this.posX + d0 * d4, 
                        this.posY + d1 * d4 + (double)this.getEyeHeight(), 
                        this.posZ + d2 * d4, 
                        0.0D, 
                        0.0D, 
                        0.0D, 
                        new int[0]);
            }
        }
    }
}