public EntityTrackerEntry(net.minecraft.src.Entity entity, int i, int j, bool flag ) { // Referenced classes of package net.minecraft.src: // Entity, MathHelper, Packet34EntityTeleport, Packet33RelEntityMoveLook, // Packet31RelEntityMove, Packet32EntityLook, Packet28EntityVelocity, DataWatcher, // Packet40EntityMetadata, EntityPlayerMP, NetServerHandler, Packet29DestroyEntity, // Packet5PlayerInventory, EntityPlayer, Packet17Sleep, EntityItem, // Packet21PickupSpawn, Packet20NamedEntitySpawn, EntityMinecart, Packet23VehicleSpawn, // EntityBoat, IAnimals, Packet24MobSpawn, EntityLiving, // EntityFish, EntityArrow, EntitySnowball, EntityFireball, // EntityEgg, EntityTNTPrimed, EntityFallingSand, Block, // EntityPainting, Packet25EntityPainting, Packet updateCounter = 0; firstUpdateDone = false; field_28165_t = 0; playerEntitiesUpdated = false; trackedPlayers = new HashSet <EntityPlayerMP>(); trackedEntity = entity; trackingDistanceThreshold = i; field_9234_e = j; shouldSendMotionUpdates = flag; encodedPosX = net.minecraft.src.MathHelper.Floor_double(entity.posX * 32D); encodedPosY = net.minecraft.src.MathHelper.Floor_double(entity.posY * 32D); encodedPosZ = net.minecraft.src.MathHelper.Floor_double(entity.posZ * 32D); encodedRotationYaw = net.minecraft.src.MathHelper.Floor_float((entity.rotationYaw * 256F) / 360F); encodedRotationPitch = net.minecraft.src.MathHelper.Floor_float((entity.rotationPitch * 256F) / 360F); }
public virtual void GetEntitiesWithinAABBForEntity(net.minecraft.src.Entity entity, net.minecraft.src.AxisAlignedBB axisalignedbb, List <Entity> list) { int i = net.minecraft.src.MathHelper.Floor_double((axisalignedbb.minY - 2D) / 16D ); int j = net.minecraft.src.MathHelper.Floor_double((axisalignedbb.maxY + 2D) / 16D ); if (i < 0) { i = 0; } if (j >= entities.Length) { j = entities.Length - 1; } for (int k = i; k <= j; k++) { List <Entity> list1 = entities[k]; for (int l = 0; l < list1.Count; l++) { net.minecraft.src.Entity entity1 = (net.minecraft.src.Entity)list1[l]; if (entity1 != entity && entity1.boundingBox.IntersectsWith(axisalignedbb)) { list.Add(entity1); } } } }
public Packet39AttachEntity(net.minecraft.src.Entity entity, net.minecraft.src.Entity vehicle) { // Referenced classes of package net.minecraft.src: // Packet, Entity, NetHandler entityId = entity.entityId; vehicleEntityId = vehicle == null ? -1 : vehicle.entityId; }
public virtual void MountEntity(net.minecraft.src.Entity entity) { entityRiderPitchDelta = 0.0D; entityRiderYawDelta = 0.0D; if (entity == null) { if (ridingEntity != null) { SetLocationAndAngles(ridingEntity.posX, ridingEntity.boundingBox.minY + (double)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 + (double)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 MovingObjectPosition(net.minecraft.src.Entity entity) { typeOfHit = net.minecraft.src.EnumMovingObjectType.ENTITY; entityHit = entity; hitVec = net.minecraft.src.Vec3D.CreateVector(entity.posX, entity.posY, entity.posZ ); }
protected internal override void AttackEntity(net.minecraft.src.Entity entity, float f) { if (f > 2.0F && f < 6F && rand.Next(10) == 0) { if (onGround) { double d = entity.posX - posX; double d1 = entity.posZ - posZ; float f1 = net.minecraft.src.MathHelper.Sqrt_double(d * d + d1 * d1); motionX = (d / (double)f1) * 0.5D * 0.80000001192092896D + motionX * 0.20000000298023224D; motionZ = (d1 / (double)f1) * 0.5D * 0.80000001192092896D + motionZ * 0.20000000298023224D; motionY = 0.40000000596046448D; } } else { if ((double)f < 1.5D && entity.boundingBox.maxY > boundingBox.minY && entity.boundingBox .minY < boundingBox.maxY) { attackTime = 20; byte byte0 = 2; if (IsTamed()) { byte0 = 4; } entity.AttackEntityFrom(this, byte0); } } }
public virtual void GetEntitiesOfTypeWithinAAAB(Type class1, net.minecraft.src.AxisAlignedBB axisalignedbb, List <Entity> list) { int i = net.minecraft.src.MathHelper.Floor_double((axisalignedbb.minY - 2D) / 16D ); int j = net.minecraft.src.MathHelper.Floor_double((axisalignedbb.maxY + 2D) / 16D ); if (i < 0) { i = 0; } if (j >= entities.Length) { j = entities.Length - 1; } for (int k = i; k <= j; k++) { List <Entity> list1 = entities[k]; for (int l = 0; l < list1.Count; l++) { net.minecraft.src.Entity entity = (net.minecraft.src.Entity)list1[l]; if (class1.IsAssignableFrom(entity.GetType()) && entity. boundingBox.IntersectsWith(axisalignedbb)) { list.Add(entity); } } } }
public override void MountEntity(net.minecraft.src.Entity entity) { base.MountEntity(entity); netServerHandler.SendPacket(new net.minecraft.src.Packet39AttachEntity(this , ridingEntity)); netServerHandler.TeleportTo(posX, posY, posZ, rotationYaw, rotationPitch); }
private void SetPathEntity(net.minecraft.src.Entity entity, float f) { net.minecraft.src.PathEntity pathentity = worldObj.GetPathToEntity(this, entity, 16F); if (pathentity == null && f > 12F) { int i = net.minecraft.src.MathHelper.Floor_double(entity.posX) - 2; int j = net.minecraft.src.MathHelper.Floor_double(entity.posZ) - 2; int k = net.minecraft.src.MathHelper.Floor_double(entity.boundingBox.minY); for (int l = 0; l <= 4; l++) { for (int i1 = 0; i1 <= 4; i1++) { if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && worldObj.IsBlockNormalCube(i + l, k - 1, j + i1) && !worldObj.IsBlockNormalCube(i + l, k, j + i1) && !worldObj.IsBlockNormalCube (i + l, k + 1, j + i1)) { SetLocationAndAngles((float)(i + l) + 0.5F, k, (float)(j + i1) + 0.5F, rotationYaw , rotationPitch); return; } } } } else { SetPathToEntity(pathentity); } }
protected internal override void AttackEntity(net.minecraft.src.Entity entity, float f) { if (f < 10F) { double d = entity.posX - posX; double d1 = entity.posZ - posZ; if (attackTime == 0) { net.minecraft.src.EntityArrow entityarrow = new net.minecraft.src.EntityArrow(worldObj , this); entityarrow.posY += 1.3999999761581421D; double d2 = (entity.posY + (double)entity.GetEyeHeight()) - 0.20000000298023224D - entityarrow.posY; float f1 = net.minecraft.src.MathHelper.Sqrt_double(d * d + d1 * d1) * 0.2F; worldObj.PlaySoundAtEntity(this, "random.bow", 1.0F, 1.0F / (rand.NextFloat() * 0.4F + 0.8F)); worldObj.AddEntity(entityarrow); entityarrow.SetArrowHeading(d, d2 + (double)f1, d1, 0.6F, 12F); attackTime = 30; } rotationYaw = (float)((System.Math.Atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F; hasAttacked = true; } }
protected internal override void AttackEntity(net.minecraft.src.Entity entity, float f) { float f1 = GetEntityBrightness(1.0F); if (f1 > 0.5F && rand.Next(100) == 0) { playerToAttack = null; return; } if (f > 2.0F && f < 6F && rand.Next(10) == 0) { if (onGround) { double d = entity.posX - posX; double d1 = entity.posZ - posZ; float f2 = net.minecraft.src.MathHelper.Sqrt_double(d * d + d1 * d1); motionX = (d / (double)f2) * 0.5D * 0.80000001192092896D + motionX * 0.20000000298023224D; motionZ = (d1 / (double)f2) * 0.5D * 0.80000001192092896D + motionZ * 0.20000000298023224D; motionY = 0.40000000596046448D; } } else { base.AttackEntity(entity, f); } }
public Packet18Animation(net.minecraft.src.Entity entity, int i) { // Referenced classes of package net.minecraft.src: // Packet, Entity, NetHandler entityId = entity.entityId; animate = i; }
public override bool AttackEntityFrom(net.minecraft.src.Entity entity, int i) { if (worldObj.singleplayerWorld || isDead) { return(true); } forwardDirection = -forwardDirection; field_9177_b = 10; damageTaken += i * 10; SetBeenAttacked(); if (damageTaken > 40) { if (riddenByEntity != null) { riddenByEntity.MountEntity(this); } for (int j = 0; j < 3; j++) { DropItemWithOffset(net.minecraft.src.Block.WOOD.ID, 1, 0.0F); } for (int k = 0; k < 2; k++) { DropItemWithOffset(net.minecraft.src.Item.STICK.ID, 1, 0.0F); } SetEntityDead(); } return(true); }
public static net.minecraft.src.Entity CreateEntityFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound, net.minecraft.src.World world) { net.minecraft.src.Entity entity = null; try { System.Type class1 = (System.Type)stringToClassMapping[nbttagcompound.GetString ("id")]; if (class1 != null) { entity = (net.minecraft.src.Entity)class1.GetConstructor(new System.Type[] { Sharpen.Runtime.GetClassForType(typeof(net.minecraft.src.World)) }).Invoke(new object[] { world }); } } catch (System.Exception exception) { Sharpen.Runtime.PrintStackTrace(exception); } if (entity != null) { entity.ReadFromNBT(nbttagcompound); } else { System.Console.Out.WriteLine((new java.lang.StringBuilder()).Append("Skipping Entity with id " ).Append(nbttagcompound.GetString("id")).ToString()); } return(entity); }
public virtual void AddEntity(net.minecraft.src.Entity entity) { hasEntities = true; int i = net.minecraft.src.MathHelper.Floor_double(entity.posX / 16D); int j = net.minecraft.src.MathHelper.Floor_double(entity.posZ / 16D); if (i != xPosition || j != zPosition) { System.Console.Out.WriteLine((new java.lang.StringBuilder()).Append("Wrong location! " ).Append(entity).ToString()); //java.lang.Thread.DumpStack(); } int k = net.minecraft.src.MathHelper.Floor_double(entity.posY / 16D); if (k < 0) { k = 0; } if (k >= entities.Length) { k = entities.Length - 1; } entity.addedToChunk = true; entity.chunkCoordX = xPosition; entity.chunkCoordY = k; entity.chunkCoordZ = zPosition; entities[k].Add(entity); }
public virtual void FaceEntity(net.minecraft.src.Entity entity, float f, float f1 ) { double d = entity.posX - posX; double d2 = entity.posZ - posZ; double d1; if (entity is net.minecraft.src.EntityLiving) { net.minecraft.src.EntityLiving entityliving = (net.minecraft.src.EntityLiving)entity; d1 = (posY + (double)GetEyeHeight()) - (entityliving.posY + (double)entityliving. GetEyeHeight()); } else { d1 = (entity.boundingBox.minY + entity.boundingBox.maxY) / 2D - (posY + (double)GetEyeHeight ()); } double d3 = net.minecraft.src.MathHelper.Sqrt_double(d * d + d2 * d2); float f2 = (float)((System.Math.Atan2(d2, d) * 180D) / 3.1415927410125732D) - 90F; float f3 = (float)(-((System.Math.Atan2(d1, d3) * 180D) / 3.1415927410125732D)); rotationPitch = -UpdateRotation(rotationPitch, f3, f1); rotationYaw = UpdateRotation(rotationYaw, f2, f); }
public virtual void ApplyEntityCollision(net.minecraft.src.Entity entity) { if (entity.riddenByEntity == this || entity.ridingEntity == this) { return; } double d = entity.posX - posX; double d1 = entity.posZ - posZ; double d2 = net.minecraft.src.MathHelper.Abs_max(d, d1); if (d2 >= 0.0099999997764825821D) { 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.05000000074505806D; d1 *= 0.05000000074505806D; d *= 1.0F - entityCollisionReduction; d1 *= 1.0F - entityCollisionReduction; AddVelocity(-d, 0.0D, -d1); entity.AddVelocity(d, 0.0D, d1); } }
public override void OnDeath(net.minecraft.src.Entity entity) { base.OnDeath(entity); if (entity is net.minecraft.src.EntitySkeleton) { DropItem(net.minecraft.src.Item.GOLD_RECORD.ID + rand.Next(2), 1); } }
public virtual double GetDistanceSqToEntity(net.minecraft.src.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 float GetDistanceToEntity(net.minecraft.src.Entity entity) { float f = (float)(posX - entity.posX); float f1 = (float)(posY - entity.posY); float f2 = (float)(posZ - entity.posZ); return(net.minecraft.src.MathHelper.Sqrt_float(f * f + f1 * f1 + f2 * f2)); }
public override void OnEntityCollidedWithBlock(net.minecraft.src.World world, int i, int j, int k, net.minecraft.src.Entity entity) { if (entity.ridingEntity == null && entity.riddenByEntity == null) { entity.SetInPortal(); } }
public override void VelocityToAddToEntity(net.minecraft.src.World world, int i, int j, int k, net.minecraft.src.Entity entity, net.minecraft.src.Vec3D vec3d) { net.minecraft.src.Vec3D vec3d1 = Func_298_c(world, i, j, k); vec3d.xCoord += vec3d1.xCoord; vec3d.yCoord += vec3d1.yCoord; vec3d.zCoord += vec3d1.zCoord; }
public override void SendTrackedEntityStatusUpdatePacket(net.minecraft.src.Entity entity, byte byte0) { net.minecraft.src.Packet38EntityStatus packet38entitystatus = new net.minecraft.src.Packet38EntityStatus (entity.entityId, byte0); mcServer.GetEntityTracker(worldProvider.worldType).SendPacketToTrackedPlayersAndTrackedEntity (entity, packet38entitystatus); }
public override void OnEntityWalking(net.minecraft.src.World world, int i, int j, int k, net.minecraft.src.Entity entity) { if (world.rand.Next(4) == 0) { world.SetBlockWithNotify(i, j, k, net.minecraft.src.Block.DIRT.ID); } }
public void Func_28143_a(net.minecraft.src.World world, net.minecraft.src.Entity entity, int i, bool flag) { if (animationsToGo > 0) { animationsToGo--; } net.minecraft.src.Item.itemsList[itemID].Func_28018_a(this, world, entity, i, flag); }
private net.minecraft.src.PathEntity AddToPath(net.minecraft.src.Entity entity, net.minecraft.src.PathPoint pathpoint, net.minecraft.src.PathPoint pathpoint1, net.minecraft.src.PathPoint pathpoint2, float f) { pathpoint.totalPathDistance = 0.0F; pathpoint.distanceToNext = pathpoint.DistanceTo(pathpoint1); pathpoint.distanceToTarget = pathpoint.distanceToNext; path.ClearPath(); path.AddPoint(pathpoint); net.minecraft.src.PathPoint pathpoint3 = pathpoint; while (!path.IsPathEmpty()) { net.minecraft.src.PathPoint pathpoint4 = path.Dequeue(); if (pathpoint4.Equals(pathpoint1)) { return(CreateEntityPath(pathpoint, pathpoint1)); } if (pathpoint4.DistanceTo(pathpoint1) < pathpoint3.DistanceTo(pathpoint1)) { pathpoint3 = pathpoint4; } pathpoint4.isFirst = true; int i = FindPathOptions(entity, pathpoint4, pathpoint2, pathpoint1, f); int j = 0; while (j < i) { net.minecraft.src.PathPoint pathpoint5 = pathOptions[j]; float f1 = pathpoint4.totalPathDistance + pathpoint4.DistanceTo(pathpoint5); if (!pathpoint5.IsAssigned() || f1 < pathpoint5.totalPathDistance) { pathpoint5.previous = pathpoint4; pathpoint5.totalPathDistance = f1; pathpoint5.distanceToNext = pathpoint5.DistanceTo(pathpoint1); if (pathpoint5.IsAssigned()) { path.ChangeDistance(pathpoint5, pathpoint5.totalPathDistance + pathpoint5.distanceToNext ); } else { pathpoint5.distanceToTarget = pathpoint5.totalPathDistance + pathpoint5.distanceToNext; path.AddPoint(pathpoint5); } } j++; } } if (pathpoint3 == pathpoint) { return(null); } else { return(CreateEntityPath(pathpoint, pathpoint3)); } }
[MethodImpl(MethodImplOptions.Synchronized)] // CRAFTBUKKIT public virtual void SendPacketToTrackedPlayersAndTrackedEntity(net.minecraft.src.Entity entity, net.minecraft.src.Packet packet) { net.minecraft.src.EntityTrackerEntry entitytrackerentry = (net.minecraft.src.EntityTrackerEntry )trackedEntityHashTable.Lookup(entity.entityId); if (entitytrackerentry != null) { entitytrackerentry.SendPacketToTrackedPlayersAndTrackedEntity(packet); } }
protected internal override void AttackEntity(net.minecraft.src.Entity entity, float f) { if (attackTime <= 0 && f < 2.0F && entity.boundingBox.maxY > boundingBox.minY && entity.boundingBox.minY < boundingBox.maxY) { attackTime = 20; entity.AttackEntityFrom(this, attackStrength); } }
public override bool AttackEntityFrom(net.minecraft.src.Entity entity, int i) { SetBeenAttacked(); health -= i; if (health <= 0) { SetEntityDead(); } return(false); }
public Packet17Sleep(net.minecraft.src.Entity entity, int i, int x, int y, int z) { // Referenced classes of package net.minecraft.src: // Packet, Entity, NetHandler UnknownByte = i; EntityX = x; EntityY = y; EntityZ = z; EntityID = entity.entityId; }