GTNewHorizons / twilightforest

Twilight Forest repository
GNU Lesser General Public License v2.1
14 stars 20 forks source link

UrGhast breaks electric helmets and others that lack durability #59

Open SrYthan opened 6 months ago

SrYthan commented 6 months ago

in the UrGhast class

private void doTantrumDamageEffects() { // harm player below AxisAlignedBB below = this.boundingBox.getOffsetBoundingBox(0, -16, 0).expand(0, 16, 0);

    List<EntityPlayer> playersBelow = worldObj.getEntitiesWithinAABB(EntityPlayer.class, below);

    for (EntityPlayer player : playersBelow) {
        int dx = MathHelper.floor_double(player.posX);
        int dy = MathHelper.floor_double(player.posY);
        int dz = MathHelper.floor_double(player.posZ);

        if (worldObj.canBlockSeeTheSky(dx, dy, dz)) {
            player.attackEntityFrom(DamageSource.anvil, 3);
        }
    }

    // also suck up mini ghasts
    List<EntityTFMiniGhast> ghastsBelow = worldObj.getEntitiesWithinAABB(EntityTFMiniGhast.class, below);

    for (EntityTFMiniGhast ghast : ghastsBelow) {
        ghast.motionY += 1;
    }
}

Change the
player.attackEntityFrom(DamageSource.anvil, 3);

to
player.attackEntityFrom(DamageSource.generic, 3);

this causes damage to player but does not break the helmets if does not have durability