/// <summary> /// If there is space to fall below will start this block falling /// </summary> private void TryToFall(World par1World, int par2, int par3, int par4) { int i = par2; int j = par3; int k = par4; if (CanFallBelow(par1World, i, j - 1, k) && j >= 0) { sbyte byte0 = 32; if (FallInstantly || !par1World.CheckChunksExist(par2 - byte0, par3 - byte0, par4 - byte0, par2 + byte0, par3 + byte0, par4 + byte0)) { par1World.SetBlockWithNotify(par2, par3, par4, 0); for (; CanFallBelow(par1World, par2, par3 - 1, par4) && par3 > 0; par3--) { } if (par3 > 0) { par1World.SetBlockWithNotify(par2, par3, par4, BlockID); } } else if (!par1World.IsRemote) { EntityFallingSand entityfallingsand = new EntityFallingSand(par1World, (float)par2 + 0.5F, (float)par3 + 0.5F, (float)par4 + 0.5F, BlockID); par1World.SpawnEntityInWorld(entityfallingsand); } } }
/// <summary> /// The actual render method that is used in doRender /// </summary> public virtual void DoRenderFallingSand(EntityFallingSand par1EntityFallingSand, double par2, double par4, double par6, float par8, float par9) { //GL.PushMatrix(); //GL.Translate((float)par2, (float)par4, (float)par6); LoadTexture("/terrain.png"); Block block = Block.BlocksList[par1EntityFallingSand.BlockID]; World world = par1EntityFallingSand.GetWorld(); //GL.Disable(EnableCap.Lighting); if (block == Block.DragonEgg) { RenderBlocks.BlockAccess = world; Tessellator tessellator = Tessellator.Instance; tessellator.StartDrawingQuads(); tessellator.SetTranslation((float)(-MathHelper2.Floor_double(par1EntityFallingSand.PosX)) - 0.5F, (float)(-MathHelper2.Floor_double(par1EntityFallingSand.PosY)) - 0.5F, (float)(-MathHelper2.Floor_double(par1EntityFallingSand.PosZ)) - 0.5F); RenderBlocks.RenderBlockByRenderType(block, MathHelper2.Floor_double(par1EntityFallingSand.PosX), MathHelper2.Floor_double(par1EntityFallingSand.PosY), MathHelper2.Floor_double(par1EntityFallingSand.PosZ)); tessellator.SetTranslation(0.0F, 0.0F, 0.0F); tessellator.Draw(); } else { RenderBlocks.RenderBlockFallingSand(block, world, MathHelper2.Floor_double(par1EntityFallingSand.PosX), MathHelper2.Floor_double(par1EntityFallingSand.PosY), MathHelper2.Floor_double(par1EntityFallingSand.PosZ)); } //GL.Enable(EnableCap.Lighting); //GL.PopMatrix(); }
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); } } }