public override void ApplyEntityCollision(net.minecraft.src.Entity entity) { if (worldObj.singleplayerWorld) { return; } if (entity == riddenByEntity) { return; } if ((entity is net.minecraft.src.EntityLiving) && !(entity is net.minecraft.src.EntityPlayer ) && minecartType == 0 && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null) { entity.MountEntity(this); } double d = entity.posX - posX; double d1 = entity.posZ - posZ; double d2 = d * d + d1 * d1; if (d2 >= 9.9999997473787516E-005D) { d2 = net.minecraft.src.MathHelper.Sqrt_double(d2); d /= d2; d1 /= d2; double d3 = 1.0D / d2; if (d3 > 1.0D) { d3 = 1.0D; } d *= d3; d1 *= d3; d *= 0.10000000149011612D; d1 *= 0.10000000149011612D; d *= 1.0F - entityCollisionReduction; d1 *= 1.0F - entityCollisionReduction; d *= 0.5D; d1 *= 0.5D; if (entity is net.minecraft.src.EntityMinecart) { double d4 = entity.posX - posX; double d5 = entity.posZ - posZ; double d6 = d4 * entity.motionZ + d5 * entity.prevPosX; d6 *= d6; if (d6 > 5D) { return; } double d7 = entity.motionX + motionX; double d8 = entity.motionZ + motionZ; if (((net.minecraft.src.EntityMinecart)entity).minecartType == 2 && minecartType != 2) { motionX *= 0.20000000298023224D; motionZ *= 0.20000000298023224D; AddVelocity(entity.motionX - d, 0.0D, entity.motionZ - d1); entity.motionX *= 0.69999998807907104D; entity.motionZ *= 0.69999998807907104D; } else { if (((net.minecraft.src.EntityMinecart)entity).minecartType != 2 && minecartType == 2) { entity.motionX *= 0.20000000298023224D; entity.motionZ *= 0.20000000298023224D; entity.AddVelocity(motionX + d, 0.0D, motionZ + d1); motionX *= 0.69999998807907104D; motionZ *= 0.69999998807907104D; } else { d7 /= 2D; d8 /= 2D; motionX *= 0.20000000298023224D; motionZ *= 0.20000000298023224D; AddVelocity(d7 - d, 0.0D, d8 - d1); entity.motionX *= 0.20000000298023224D; entity.motionZ *= 0.20000000298023224D; entity.AddVelocity(d7 + d, 0.0D, d8 + d1); } } } else { AddVelocity(-d, 0.0D, -d1); entity.AddVelocity(d / 4D, 0.0D, d1 / 4D); } } }