public override bool Generate(World par1World, Random par2Random, int par3, int par4, int par5) { if (!par1World.IsAirBlock(par3, par4, par5) || par1World.GetBlockId(par3, par4 - 1, par5) != ReplaceID) { return(false); } int i = par2Random.Next(32) + 6; int j = par2Random.Next(4) + 1; for (int k = par3 - j; k <= par3 + j; k++) { for (int i1 = par5 - j; i1 <= par5 + j; i1++) { int k1 = k - par3; int i2 = i1 - par5; if (k1 * k1 + i2 * i2 <= j * j + 1 && par1World.GetBlockId(k, par4 - 1, i1) != ReplaceID) { return(false); } } } for (int l = par4; l < par4 + i && l < 128; l++) { for (int j1 = par3 - j; j1 <= par3 + j; j1++) { for (int l1 = par5 - j; l1 <= par5 + j; l1++) { int j2 = j1 - par3; int k2 = l1 - par5; if (j2 * j2 + k2 * k2 <= j * j + 1) { par1World.SetBlockWithNotify(j1, l, l1, Block.Obsidian.BlockID); } } } } EntityEnderCrystal entityendercrystal = new EntityEnderCrystal(par1World); entityendercrystal.SetLocationAndAngles((float)par3 + 0.5F, par4 + i, (float)par5 + 0.5F, par2Random.NextFloat() * 360F, 0.0F); par1World.SpawnEntityInWorld(entityendercrystal); par1World.SetBlockWithNotify(par3, par4 + i, par5, Block.Bedrock.BlockID); return(true); }
/// <summary> /// Updates the state of the enderdragon's current endercrystal. /// </summary> private void UpdateDragonEnderCrystal() { if (HealingEnderCrystal != null) { if (HealingEnderCrystal.IsDead) { if (!WorldObj.IsRemote) { AttackEntityFromPart(DragonPartHead, DamageSource.Explosion, 10); } HealingEnderCrystal = null; } else if (TicksExisted % 10 == 0 && Health < MaxHealth) { Health++; } } if (Rand.Next(10) == 0) { float f = 32F; List <Entity> list = WorldObj.GetEntitiesWithinAABB(typeof(net.minecraft.src.EntityEnderCrystal), BoundingBox.Expand(f, f, f)); EntityEnderCrystal entityendercrystal = null; double d = double.MaxValue; IEnumerator <Entity> iterator = list.GetEnumerator(); do { if (!iterator.MoveNext()) { break; } Entity entity = iterator.Current; double d1 = entity.GetDistanceSqToEntity(this); if (d1 < d) { d = d1; entityendercrystal = (EntityEnderCrystal)entity; } }while (true); HealingEnderCrystal = entityendercrystal; } }
public virtual void Func_41035_a(EntityEnderCrystal par1EntityEnderCrystal, double par2, double par4, double par6, float par8, float par9) { if (Field_41037_a != 1) { Field_41036_b = new ModelEnderCrystal(0.0F); Field_41037_a = 1; } float f = (float)par1EntityEnderCrystal.InnerRotation + par9; //GL.PushMatrix(); //GL.Translate((float)par2, (float)par4, (float)par6); LoadTexture("/mob/enderdragon/crystal.png"); float f1 = MathHelper2.Sin(f * 0.2F) / 2.0F + 0.5F; f1 = f1 * f1 + f1; Field_41036_b.Render(par1EntityEnderCrystal, 0.0F, f * 3F, f1 * 0.2F, 0.0F, 0.0F, 0.0625F); //GL.PopMatrix(); }
public EntityDragon(World par1World) : base(par1World) { //ORIGINAL LINE: Field_40162_d = new double[64][3]; //JAVA TO C# CONVERTER NOTE: The following call to the 'RectangularArrays' helper class reproduces the rectangular array initialization that is automatic in Java: Field_40162_d = JavaHelper.ReturnRectangularArray <float>(64, 3); Field_40164_e = -1; Field_40173_aw = 0.0F; Field_40172_ax = 0.0F; Field_40163_ay = false; Field_40161_az = false; Field_40178_aA = 0; HealingEnderCrystal = null; DragonPartArray = (new EntityDragonPart[] { DragonPartHead = new EntityDragonPart(this, "head", 6F, 6F), DragonPartBody = new EntityDragonPart(this, "body", 8F, 8F), DragonPartTail1 = new EntityDragonPart(this, "tail", 4F, 4F), DragonPartTail2 = new EntityDragonPart(this, "tail", 4F, 4F), DragonPartTail3 = new EntityDragonPart(this, "tail", 4F, 4F), DragonPartWing1 = new EntityDragonPart(this, "wing", 4F, 4F), DragonPartWing2 = new EntityDragonPart(this, "wing", 4F, 4F) }); MaxHealth = 200; SetEntityHealth(MaxHealth); Texture = "/mob/enderdragon/ender.png"; SetSize(16F, 8F); NoClip = true; isImmuneToFire_Renamed = true; TargetY = 100; IgnoreFrustumCheck = true; }
public override void HandleVehicleSpawn(Packet23VehicleSpawn par1Packet23VehicleSpawn) { float d = par1Packet23VehicleSpawn.XPosition / 3F; float d1 = par1Packet23VehicleSpawn.YPosition / 3F; float d2 = par1Packet23VehicleSpawn.ZPosition / 3F; Entity obj = null; if (par1Packet23VehicleSpawn.Type == 10) { obj = new EntityMinecart(WorldClient, d, d1, d2, 0); } else if (par1Packet23VehicleSpawn.Type == 11) { obj = new EntityMinecart(WorldClient, d, d1, d2, 1); } else if (par1Packet23VehicleSpawn.Type == 12) { obj = new EntityMinecart(WorldClient, d, d1, d2, 2); } else if (par1Packet23VehicleSpawn.Type == 90) { obj = new EntityFishHook(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 60) { obj = new EntityArrow(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 61) { obj = new EntitySnowball(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 65) { obj = new EntityEnderPearl(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 72) { obj = new EntityEnderEye(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 63) { obj = new EntityFireball(WorldClient, d, d1, d2, par1Packet23VehicleSpawn.SpeedX / 8000F, par1Packet23VehicleSpawn.SpeedY / 8000F, par1Packet23VehicleSpawn.SpeedZ / 8000F); par1Packet23VehicleSpawn.ThrowerEntityId = 0; } else if (par1Packet23VehicleSpawn.Type == 64) { obj = new EntitySmallFireball(WorldClient, d, d1, d2, par1Packet23VehicleSpawn.SpeedX / 8000F, par1Packet23VehicleSpawn.SpeedY / 8000F, par1Packet23VehicleSpawn.SpeedZ / 8000F); par1Packet23VehicleSpawn.ThrowerEntityId = 0; } else if (par1Packet23VehicleSpawn.Type == 62) { obj = new EntityEgg(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 73) { obj = new EntityPotion(WorldClient, d, d1, d2, par1Packet23VehicleSpawn.ThrowerEntityId); par1Packet23VehicleSpawn.ThrowerEntityId = 0; } else if (par1Packet23VehicleSpawn.Type == 75) { obj = new EntityExpBottle(WorldClient, d, d1, d2); par1Packet23VehicleSpawn.ThrowerEntityId = 0; } else if (par1Packet23VehicleSpawn.Type == 1) { obj = new EntityBoat(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 50) { obj = new EntityTNTPrimed(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 51) { obj = new EntityEnderCrystal(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 70) { obj = new EntityFallingSand(WorldClient, d, d1, d2, Block.Sand.BlockID); } else if (par1Packet23VehicleSpawn.Type == 71) { obj = new EntityFallingSand(WorldClient, d, d1, d2, Block.Gravel.BlockID); } else if (par1Packet23VehicleSpawn.Type == 74) { obj = new EntityFallingSand(WorldClient, d, d1, d2, Block.DragonEgg.BlockID); } if (obj != null) { obj.ServerPosX = par1Packet23VehicleSpawn.XPosition; obj.ServerPosY = par1Packet23VehicleSpawn.YPosition; obj.ServerPosZ = par1Packet23VehicleSpawn.ZPosition; obj.RotationYaw = 0.0F; obj.RotationPitch = 0.0F; Entity[] aentity = ((Entity)(obj)).GetParts(); if (aentity != null) { int i = par1Packet23VehicleSpawn.EntityId - ((Entity)(obj)).EntityId; for (int j = 0; j < aentity.Length; j++) { aentity[j].EntityId += i; } } obj.EntityId = par1Packet23VehicleSpawn.EntityId; WorldClient.AddEntityToWorld(par1Packet23VehicleSpawn.EntityId, ((Entity)(obj))); if (par1Packet23VehicleSpawn.ThrowerEntityId > 0) { if (par1Packet23VehicleSpawn.Type == 60) { Entity entity = GetEntityByID(par1Packet23VehicleSpawn.ThrowerEntityId); if (entity is EntityLiving) { ((EntityArrow)obj).ShootingEntity = (EntityLiving)entity; } } ((Entity)(obj)).SetVelocity(par1Packet23VehicleSpawn.SpeedX / 8000F, par1Packet23VehicleSpawn.SpeedY / 8000F, par1Packet23VehicleSpawn.SpeedZ / 8000F); } } }