()
| 88 | private Map field_77288_k = new HashMap<>(); |
| 89 | |
| 90 | @Override |
| 91 | @SuppressWarnings("unchecked") |
| 92 | public void doExplosionA() { |
| 93 | float tSize = explosionSize; |
| 94 | HashSet<ChunkPosition> tPositions = new HashSet<>(); |
| 95 | for (int i = 0; i < 16; ++i) for (int j = 0; j < 16; ++j) for (int k = 0; k < 16; ++k) { |
| 96 | if (i == 0 || i == 15 || j == 0 || j == 15 || k == 0 || k == 15) { |
| 97 | double tIncX = i / 7.5F - 1, tIncY = j / 7.5F - 1, tIncZ = k / 7.5F - 1; |
| 98 | double tDist = Math.sqrt(tIncX * tIncX + tIncY * tIncY + tIncZ * tIncZ); |
| 99 | tIncX /= tDist; tIncY /= tDist; tIncZ /= tDist; |
| 100 | float tPow = tSize * (0.7F + mWorld.rand.nextFloat() * 0.6F); |
| 101 | double tX = explosionX, tY = explosionY, tZ = explosionZ; |
| 102 | for (float tMul = 0.3F; tPow > 0; tPow -= tMul * 0.75F) { |
| 103 | int tFloorX = UT.Code.roundDown(tX), tFloorY = UT.Code.roundDown(tY), tFloorZ = UT.Code.roundDown(tZ); |
| 104 | Block tBlock = mWorld.getBlock(tFloorX, tFloorY, tFloorZ); |
| 105 | if (tBlock.getMaterial() != Material.air) { |
| 106 | float f3 = exploder != null ? exploder.func_145772_a(this, mWorld, tFloorX, tFloorY, tFloorZ, tBlock) : tBlock.getExplosionResistance(exploder, mWorld, tFloorX, tFloorY, tFloorZ, explosionX, explosionY, explosionZ); |
| 107 | tPow -= (f3 + 0.3F) * tMul; |
| 108 | } |
| 109 | if (tPow > 0 && (exploder == null || exploder.func_145774_a(this, mWorld, tFloorX, tFloorY, tFloorZ, tBlock, tPow))) { |
| 110 | tPositions.add(new ChunkPosition(tFloorX, tFloorY, tFloorZ)); |
| 111 | } |
| 112 | tX += tIncX * tMul; tY += tIncY * tMul; tZ += tIncZ * tMul; |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | affectedBlockPositions.addAll(tPositions); |
| 117 | tSize *= 2; |
| 118 | @SuppressWarnings("rawtypes") |
| 119 | List tEntities = mWorld.getEntitiesWithinAABBExcludingEntity(exploder, AxisAlignedBB.getBoundingBox(UT.Code.roundDown(explosionX - tSize - 1), UT.Code.roundDown(explosionY - tSize - 1), UT.Code.roundDown(explosionZ - tSize - 1), UT.Code.roundDown(explosionX + tSize + 1), UT.Code.roundDown(explosionY + tSize + 1), UT.Code.roundDown(explosionZ + tSize + 1))); |
| 120 | net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(mWorld, this, tEntities, tSize); |
| 121 | Vec3 tVec3 = Vec3.createVectorHelper(explosionX, explosionY, explosionZ); |
| 122 | for (int i1 = 0; i1 < tEntities.size(); ++i1) { |
| 123 | Entity tEntity = (Entity)tEntities.get(i1); |
| 124 | double tEntityDist = tEntity.getDistance(explosionX, explosionY, explosionZ) / tSize; |
| 125 | if (tEntityDist <= 1 && !(tEntity instanceof EntityWither || tEntity instanceof EntityDragon || tEntity instanceof EntityDragonPart || tEntity.getClass().getName().toLowerCase().contains("boss"))) { |
| 126 | double tKnockX = tEntity.posX - explosionX, tKnockY = tEntity.posY + tEntity.getEyeHeight() - explosionY, tKnockZ = tEntity.posZ - explosionZ; |
| 127 | double tDist = MathHelper.sqrt_double(tKnockX * tKnockX + tKnockY * tKnockY + tKnockZ * tKnockZ); |
| 128 | if (tDist > 0) { |
| 129 | tKnockX /= tDist; |
| 130 | tKnockY /= tDist; |
| 131 | tKnockZ /= tDist; |
| 132 | double tKnockback = (1 - tEntityDist) * mWorld.getBlockDensity(tVec3, tEntity.boundingBox); |
| 133 | tEntity.attackEntityFrom(DamageSource.setExplosionSource(this), ((int)((tKnockback * tKnockback + tKnockback) * 4 * tSize + 1)) * TFC_DAMAGE_MULTIPLIER); |
| 134 | double tBlastProtection = EnchantmentProtection.func_92092_a(tEntity, tKnockback); |
| 135 | tEntity.motionX += tKnockX * tBlastProtection; |
| 136 | tEntity.motionY += tKnockY * tBlastProtection; |
| 137 | tEntity.motionZ += tKnockZ * tBlastProtection; |
| 138 | |
| 139 | if (tEntity instanceof EntityPlayer) field_77288_k.put(tEntity, Vec3.createVectorHelper(tKnockX * tKnockback, tKnockY * tKnockback, tKnockZ * tKnockback)); |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | @Override |
| 146 | public void doExplosionB(boolean aEffects) { |
no test coverage detected