public override bool attackEntityFrom(Entity entity, int i) { age = 0; if (health <= 0) { return false; } if (isPlayerSleeping()) { wakeUpPlayer(true, true); } if ((entity is EntityMobs) || (entity is EntityArrow)) { if (worldObj.difficultySetting == 0) { i = 0; } if (worldObj.difficultySetting == 1) { i = i/3 + 1; } if (worldObj.difficultySetting == 3) { i = (i*3)/2; } } if (i == 0) { return false; } else { return base.attackEntityFrom(entity, i); } }
public override bool attackEntityFrom(Entity entity, int i) { if (worldObj.singleplayerWorld || isDead) { return true; } forwardDirection = -forwardDirection; field_9177_b = 10; damageTaken += i*10; setBeenAttacked(); if (damageTaken > 40) { for (int j = 0; j < 3; j++) { dropItemWithOffset(Block.planks.blockID, 1, 0.0F); } for (int k = 0; k < 2; k++) { dropItemWithOffset(Item.stick.shiftedIndex, 1, 0.0F); } setEntityDead(); } return true; }
public override void onEntityWalking(World world, int i, int j, int k, Entity entity) { if (world.rand.nextInt(4) == 0) { world.setBlockWithNotify(i, j, k, dirt.blockID); } }
public Packet23VehicleSpawn(Entity entity, int i) { entityId = entity.entityId; xPosition = MathHelper.floor_double(entity.posX*32D); yPosition = MathHelper.floor_double(entity.posY*32D); zPosition = MathHelper.floor_double(entity.posZ*32D); type = i; }
public Packet17Sleep(Entity entity, int i, int j, int k, int l) { field_22042_e = i; field_22040_b = j; field_22044_c = k; field_22043_d = l; field_22041_a = entity.entityId; }
public void sendPacketToTrackedPlayersAndTrackedEntity(Entity entity, Packet packet) { var entitytrackerentry = (EntityTrackerEntry) trackedEntityHashTable.lookup(entity.entityId); if (entitytrackerentry != null) { entitytrackerentry.sendPacketToTrackedPlayersAndTrackedEntity(packet); } }
public Packet34EntityTeleport(Entity entity) { entityId = entity.entityId; xPosition = MathHelper.floor_double(entity.posX*32D); yPosition = MathHelper.floor_double(entity.posY*32D); zPosition = MathHelper.floor_double(entity.posZ*32D); yaw = (byte) (int) ((entity.rotationYaw*256F)/360F); pitch = (byte) (int) ((entity.rotationPitch*256F)/360F); }
public override bool attackEntityFrom(Entity entity, int i) { if (!isDead && !worldObj.singleplayerWorld) { setEntityDead(); setBeenAttacked(); worldObj.entityJoinedWorld(new EntityItem(worldObj, posX, posY, posZ, new ItemStack(Item.painting))); } return true; }
public override bool attackEntityFrom(Entity entity, int i) { setBeenAttacked(); health -= i; if (health <= 0) { setEntityDead(); } return false; }
public Explosion(World world, Entity entity, double d, double d1, double d2, float f) { isFlaming = false; ExplosionRNG = new Random(); destroyedBlockPositions = new HashSet(); worldObj = world; exploder = entity; explosionSize = f; explosionX = d; explosionY = d1; explosionZ = d2; }
public override void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity) { if (world.singleplayerWorld) { return; } else { entity.setInPortal(); return; } }
public override bool attackEntityFrom(Entity entity, int i) { if (!worldObj.singleplayerWorld && !func_21069_f_() && (entity is EntityLiving)) { setSheared(true); int j = 1 + rand.nextInt(3); for (int k = 0; k < j; k++) { EntityItem entityitem = entityDropItem(new ItemStack(Block.cloth.blockID, 1, getFleeceColor()), 1.0F); entityitem.motionY += rand.nextFloat()*0.05F; entityitem.motionX += (rand.nextFloat() - rand.nextFloat())*0.1F; entityitem.motionZ += (rand.nextFloat() - rand.nextFloat())*0.1F; } } return base.attackEntityFrom(entity, i); }
public override void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity) { if (world.singleplayerWorld) { return; } if (world.getBlockMetadata(i, j, k) == 1) { return; } else { setStateIfMobInteractsWithPlate(world, i, j, k); return; } }
public EntityTrackerEntry(Entity entity, int i, int j, bool flag) { updateCounter = 0; firstUpdateDone = false; playerEntitiesUpdated = false; trackedPlayers = new HashSet(); trackedEntity = entity; trackingDistanceThreshold = i; field_9234_e = j; shouldSendMotionUpdates = flag; encodedPosX = MathHelper.floor_double(entity.posX*32D); encodedPosY = MathHelper.floor_double(entity.posY*32D); encodedPosZ = MathHelper.floor_double(entity.posZ*32D); encodedRotationYaw = MathHelper.floor_float((entity.rotationYaw*256F)/360F); encodedRotationPitch = MathHelper.floor_float((entity.rotationPitch*256F)/360F); }
public override bool attackEntityFrom(Entity entity, int i) { setBeenAttacked(); if (entity != null) { Vec3D vec3d = entity.getLookVec(); if (vec3d != null) { motionX = vec3d.xCoord; motionY = vec3d.yCoord; motionZ = vec3d.zCoord; field_9199_b = motionX*0.10000000000000001D; field_9198_c = motionY*0.10000000000000001D; field_9196_d = motionZ*0.10000000000000001D; } return true; } else { return false; } }
public override void onEntityWalking(World world, int i, int j, int k, Entity entity) { func_321_g(world, i, j, k); base.onEntityWalking(world, i, j, k, entity); }
public void attackTargetEntityWithCurrentItem(Entity entity) { int i = inventory.getDamageVsEntity(entity); if (i > 0) { entity.attackEntityFrom(this, i); ItemStack itemstack = getCurrentEquippedItem(); if (itemstack != null && (entity is EntityLiving)) { itemstack.hitEntity((EntityLiving) entity); if (itemstack.stackSize <= 0) { itemstack.func_577_a(this); destroyCurrentEquippedItem(); } } } }
public override void addToPlayerScore(Entity entity, int i) { score += i; }
public double getDistanceSqToEntity(Entity entity) { double d = posX - entity.posX; double d1 = posY - entity.posY; double d2 = posZ - entity.posZ; return d*d + d1*d1 + d2*d2; }
public virtual void useCurrentItemOnEntity(Entity entity) { if (entity.interact(this)) { return; } ItemStack itemstack = getCurrentEquippedItem(); if (itemstack != null && (entity is EntityLiving)) { itemstack.useItemOnEntity((EntityLiving) entity); if (itemstack.stackSize <= 0) { itemstack.func_577_a(this); destroyCurrentEquippedItem(); } } }
private void func_171_h(Entity entity) { entity.onCollideWithPlayer(this); }
public virtual AxisAlignedBB func_89_d(Entity entity) { return null; }
public virtual void onItemPickup(Entity entity, int i) { }
public override AxisAlignedBB func_89_d(Entity entity) { return entity.boundingBox; }
public virtual int getDamageVsEntity(Entity entity) { return Item.itemsList[itemID].getDamageVsEntity(entity); }
public float getDistanceToEntity(Entity entity) { var f = (float) (posX - entity.posX); var f1 = (float) (posY - entity.posY); var f2 = (float) (posZ - entity.posZ); return MathHelper.sqrt_float(f*f + f1*f1 + f2*f2); }
public virtual void updateRidden() { if (ridingEntity.isDead) { ridingEntity = null; return; } motionX = 0.0D; motionY = 0.0D; motionZ = 0.0D; onUpdate(); ridingEntity.updateRiderPosition(); entityRiderYawDelta += ridingEntity.rotationYaw - ridingEntity.prevRotationYaw; entityRiderPitchDelta += ridingEntity.rotationPitch - ridingEntity.prevRotationPitch; for (; entityRiderYawDelta >= 180D; entityRiderYawDelta -= 360D) { } for (; entityRiderYawDelta < -180D; entityRiderYawDelta += 360D) { } for (; entityRiderPitchDelta >= 180D; entityRiderPitchDelta -= 360D) { } for (; entityRiderPitchDelta < -180D; entityRiderPitchDelta += 360D) { } double d = entityRiderYawDelta*0.5D; double d1 = entityRiderPitchDelta*0.5D; float f = 10F; if (d > f) { d = f; } if (d < (-f)) { d = -f; } if (d1 > f) { d1 = f; } if (d1 < (-f)) { d1 = -f; } entityRiderYawDelta -= d; entityRiderPitchDelta -= d1; rotationYaw += (float) d; rotationPitch += (float) d1; }
public virtual void mountEntity(Entity entity) { entityRiderPitchDelta = 0.0D; entityRiderYawDelta = 0.0D; if (entity == null) { if (ridingEntity != null) { setLocationAndAngles(ridingEntity.posX, ridingEntity.boundingBox.minY + ridingEntity.height, ridingEntity.posZ, rotationYaw, rotationPitch); ridingEntity.riddenByEntity = null; } ridingEntity = null; return; } if (ridingEntity == entity) { ridingEntity.riddenByEntity = null; ridingEntity = null; setLocationAndAngles(entity.posX, entity.boundingBox.minY + entity.height, entity.posZ, rotationYaw, rotationPitch); return; } if (ridingEntity != null) { ridingEntity.riddenByEntity = null; } if (entity.riddenByEntity != null) { entity.riddenByEntity.ridingEntity = null; } ridingEntity = entity; entity.riddenByEntity = this; }
public virtual void onEntityUpdate() { if (ridingEntity != null && ridingEntity.isDead) { ridingEntity = null; } ticksExisted++; prevDistanceWalkedModified = distanceWalkedModified; prevPosX = posX; prevPosY = posY; prevPosZ = posZ; prevRotationPitch = rotationPitch; prevRotationYaw = rotationYaw; if (handleWaterMovement()) { if (!inWater && !field_4131_c) { float f = MathHelper.sqrt_double(motionX*motionX*0.20000000298023224D + motionY*motionY + motionZ*motionZ*0.20000000298023224D)*0.2F; if (f > 1.0F) { f = 1.0F; } worldObj.playSoundAtEntity(this, "random.splash", f, 1.0F + (rand.nextFloat() - rand.nextFloat())*0.4F); float f1 = MathHelper.floor_double(boundingBox.minY); for (int i = 0; i < 1.0F + width*20F; i++) { float f2 = (rand.nextFloat()*2.0F - 1.0F)*width; float f4 = (rand.nextFloat()*2.0F - 1.0F)*width; worldObj.spawnParticle("bubble", posX + f2, f1 + 1.0F, posZ + f4, motionX, motionY - (rand.nextFloat()*0.2F), motionZ); } for (int j = 0; j < 1.0F + width*20F; j++) { float f3 = (rand.nextFloat()*2.0F - 1.0F)*width; float f5 = (rand.nextFloat()*2.0F - 1.0F)*width; worldObj.spawnParticle("splash", posX + f3, f1 + 1.0F, posZ + f5, motionX, motionY, motionZ); } } fallDistance = 0.0F; inWater = true; fire = 0; } else { inWater = false; } if (worldObj.singleplayerWorld) { fire = 0; } else if (fire > 0) { if (isImmuneToFire) { fire -= 4; if (fire < 0) { fire = 0; } } else { if (fire%20 == 0) { attackEntityFrom(null, 1); } fire--; } } if (handleLavaMovement()) { setOnFireFromLava(); } if (posY < -64D) { kill(); } if (!worldObj.singleplayerWorld) { func_21041_a(0, fire > 0); func_21041_a(2, ridingEntity != null); } field_4131_c = false; }
public override void onDeath(Entity entity) { base.onDeath(entity); setSize(0.2F, 0.2F); setPosition(posX, posY, posZ); motionY = 0.10000000149011612D; if (username.Equals("Notch")) { dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true); } inventory.dropAllItems(); if (entity != null) { motionX = -MathHelper.cos(((attackedAtYaw + rotationYaw)*3.141593F)/180F)*0.1F; motionZ = -MathHelper.sin(((attackedAtYaw + rotationYaw)*3.141593F)/180F)*0.1F; } else { motionX = motionZ = 0.0D; } yOffset = 0.1F; }