Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void tryDig(EntityCreature entityliving, EntityLiving entityliving1) {
- if(entityliving1 == null) {
- return;
- }
- float f = 2.0F;
- float f1 = entityliving.prevRotationPitch + (entityliving.rotationPitch - entityliving.prevRotationPitch) * f;
- float f2 = entityliving.prevRotationPitch + (entityliving.rotationPitch - entityliving.prevRotationPitch) * f;
- f1 = 0.0F;
- float f3 = entityliving.prevRotationYaw + (entityliving.rotationYaw - entityliving.prevRotationYaw) * f;
- int i = (int)Math.floor((double)(f3 / 90F) + 0.5D);
- f3 = (float)i * 90F;
- double d = entityliving.prevPosX + (entityliving.posX - entityliving.prevPosX) * (double)f;
- double d1 = (entityliving.prevPosY + (entityliving.posY - entityliving.prevPosY) * (double)f + 1.6200000000000001D) - (double)entityliving.yOffset;
- double d2 = entityliving.prevPosZ + (entityliving.posZ - entityliving.prevPosZ) * (double)f;
- Vec3D vec3d = Vec3D.createVector(d, d1, d2);
- float f4 = MathHelper.cos(-f3 * 0.01745329F - 3.141593F);
- float f5 = MathHelper.sin(-f3 * 0.01745329F - 3.141593F);
- float f6 = -MathHelper.cos(-f1 * 0.01745329F - 0.7853982F);
- float f7 = MathHelper.sin(-f1 * 0.01745329F - 0.7853982F);
- float f8 = f5 * f6;
- float f9 = f7;
- float f10 = f4 * f6;
- entityliving.info = f3;
- double d3 = 1.0D;
- double d4 = 1.8D;
- double d5 = 0.050000000000000003D;
- Vec3D vec3d1 = vec3d.addVector((double)f8 * d3, (double)f9 * d3, (double)f10 * d3);
- MovingObjectPosition movingobjectposition = entityliving.worldObj.rayTraceBlocks_do(vec3d, vec3d1, true);
- if(movingobjectposition == null) {
- return;
- }
- int j = MathHelper.floor_float((float)(entityliving.posX - entityliving1.posX));
- int k = (int)(entityliving.posY - entityliving1.posY);
- int l = MathHelper.floor_float((float)(entityliving.posZ - entityliving1.posZ));
- boolean flag = false;
- if(j + l > 0) {
- if((float)(k / (j + l)) > 1.0F) {
- flag = true;
- }
- } else if(k > 2) {
- flag = true;
- }
- if(movingobjectposition.typeOfHit == EnumMovingObjectType.TILE || flag) {
- int i2 = f2 >= -20F ? 0 : 1;
- int i1;
- int j1;
- int k1;
- if(flag) {
- i1 = (int)entityliving.posX;
- j1 = (int)entityliving.posZ - 1;
- k1 = (int)entityliving.posZ;
- } else {
- i1 = movingobjectposition.blockX;
- j1 = movingobjectposition.blockY + i2;
- k1 = movingobjectposition.blockZ;
- }
- int l1 = entityliving.worldObj.getBlockId(i1, j1, k1);
- if(l1 == 0 && (i2 == 1 || flag)) {
- j1--;
- l1 = entityliving.worldObj.getBlockId(i1, j1, k1);
- if(l1 == 0 && i2 == 1) {
- j1--;
- l1 = entityliving.worldObj.getBlockId(i1, j1, k1);
- }
- }
- if(i1 != entityliving.curBlockX || j1 != entityliving.curBlockZ) {
- entityliving.curBlockDmg = 0.0F;
- entityliving.curBlockX = i1;
- entityliving.curBlockZ = j1;
- }
- Block block = Block.blocksList[l1];
- float f11 = MiningZombieDigPower.get() * (float)(entityliving.nearbyMinerCount + 1);
- if(block != null) {
- if(entityliving instanceof EntityZombieMiner) {
- ((EntityZombieMiner)entityliving).swingArm = true;
- }
- double d6 = (double)f8 * d5;
- double d7 = (double)f9 * d5;
- double d8 = (double)f10 * d5;
- for(int j2 = 0; j2 <= (int)entityliving.curBlockDmg; j2++) {
- entityliving.worldObj.spawnParticle("explode", d + ((double)f8 * d4 + (double)(entityliving.worldObj.rand.nextFloat() * (entityliving.curBlockDmg / 10F))), d1 + (double)f9 * d4 + 0.0D + (double)((entityliving.worldObj.rand.nextFloat() * entityliving.curBlockDmg) / 10F), d2 + ((double)f10 * d4 + (double)((entityliving.worldObj.rand.nextFloat() * entityliving.curBlockDmg) / 10F)), 0.0D, 0.0D, 0.0D);
- }
- mc.effectRenderer.addBlockHitEffects((int)i1, (int)j1, (int)k1, 0);
- entityliving.worldObj.playSoundAtEntity(entityliving, "step.stone", 1.0F, 1.0F / (entityliving.worldObj.rand.nextFloat() * 0.4F + 0.8F));
- entityliving.curBlockDmg += f11 / (float)block.blockHardness;
- if(entityliving.getDistanceToEntity(theplayer) >= 17F);
- if(entityliving.curBlockDmg > 10F) {
- entityliving.curBlockDmg = 0.0F;
- mc.effectRenderer.addBlockDestroyEffects((int)i1, (int)j1, (int)k1, 1, 0);
- entityliving.worldObj.spawnParticle("flame", d + (double)f8 * d4, d1 + (double)f9 * d4, d2 + (double)f10 * d4, d6 / 2D, d7 / 2D, d8 / 2D);
- entityliving.worldObj.setBlockWithNotify(i1, j1, k1, 0);
- mineComplete(entityliving);
- entityliving.nearbyMinerCount = 0;
- Object obj = null;
- List list = entityliving.worldObj.getEntitiesWithinAABBExcludingEntity(entityliving, entityliving.boundingBox.expand(2D, 2D, 2D));
- if(list != null) {
- for(int k2 = 0; k2 < list.size(); k2++) {
- Entity entity = (Entity)list.get(k2);
- if(entity instanceof EntityCreature) {
- entityliving.nearbyMinerCount++;
- mineComplete((EntityCreature)entity);
- }
- }
- }
- }
- if(entityliving.worldObj.getBlockMaterial(i1, j1, k1) != Material.ground) {
- if(entityliving.worldObj.getBlockMaterial(i1, j1, k1) != Material.rock);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment