public override void HandleBed(Packet70Bed par1Packet70Bed) { EntityPlayerSP entityplayersp = Mc.ThePlayer; int i = par1Packet70Bed.BedState; if (i >= 0 && i < Packet70Bed.BedChat.Length && Packet70Bed.BedChat[i] != null) { entityplayersp.AddChatMessage(Packet70Bed.BedChat[i]); } if (i == 1) { WorldClient.GetWorldInfo().SetRaining(true); WorldClient.SetRainStrength(1.0F); } else if (i == 2) { WorldClient.GetWorldInfo().SetRaining(false); WorldClient.SetRainStrength(0.0F); } else if (i == 3) { ((PlayerControllerMP)Mc.PlayerController).SetCreative(par1Packet70Bed.GameMode == 1); } else if (i == 4) { Mc.DisplayGuiScreen(new GuiWinGame()); } }
public override void HandleTransaction(Packet106Transaction par1Packet106Transaction) { Container container = null; EntityPlayerSP entityplayersp = Mc.ThePlayer; if (par1Packet106Transaction.WindowId == 0) { container = entityplayersp.InventorySlots; } else if (par1Packet106Transaction.WindowId == entityplayersp.CraftingInventory.WindowId) { container = entityplayersp.CraftingInventory; } if (container != null) { if (par1Packet106Transaction.Accepted) { container.Func_20113_a(par1Packet106Transaction.ShortWindowId); } else { container.Func_20110_b(par1Packet106Transaction.ShortWindowId); AddToSendQueue(new Packet106Transaction(par1Packet106Transaction.WindowId, par1Packet106Transaction.ShortWindowId, true)); } } }
public override void Func_50100_a(Packet202PlayerAbilities par1Packet202PlayerAbilities) { EntityPlayerSP entityplayersp = Mc.ThePlayer; entityplayersp.Capabilities.IsFlying = par1Packet202PlayerAbilities.Field_50070_b; entityplayersp.Capabilities.IsCreativeMode = par1Packet202PlayerAbilities.Field_50069_d; entityplayersp.Capabilities.DisableDamage = par1Packet202PlayerAbilities.Field_50072_a; entityplayersp.Capabilities.AllowFlying = par1Packet202PlayerAbilities.Field_50071_c; }
public override void HandleUpdateProgressbar(Packet105UpdateProgressbar par1Packet105UpdateProgressbar) { EntityPlayerSP entityplayersp = Mc.ThePlayer; RegisterPacket(par1Packet105UpdateProgressbar); if (entityplayersp.CraftingInventory != null && entityplayersp.CraftingInventory.WindowId == par1Packet105UpdateProgressbar.WindowId) { entityplayersp.CraftingInventory.UpdateProgressBar(par1Packet105UpdateProgressbar.ProgressBar, par1Packet105UpdateProgressbar.ProgressBarValue); } }
public override void HandleWindowItems(Packet104WindowItems par1Packet104WindowItems) { EntityPlayerSP entityplayersp = Mc.ThePlayer; if (par1Packet104WindowItems.WindowId == 0) { entityplayersp.InventorySlots.PutStacksInSlots(par1Packet104WindowItems.ItemStack); } else if (par1Packet104WindowItems.WindowId == entityplayersp.CraftingInventory.WindowId) { entityplayersp.CraftingInventory.PutStacksInSlots(par1Packet104WindowItems.ItemStack); } }
public virtual void UpdateEquippedItem() { PrevEquippedProgress = EquippedProgress; EntityPlayerSP entityplayersp = Mc.ThePlayer; ItemStack itemstack = ((EntityPlayer)(entityplayersp)).Inventory.GetCurrentItem(); ItemStack itemstack1 = itemstack; bool flag = EquippedItemSlot == ((EntityPlayer)(entityplayersp)).Inventory.CurrentItem && itemstack1 == ItemToRender; if (ItemToRender == null && itemstack1 == null) { flag = true; } if (itemstack1 != null && ItemToRender != null && itemstack1 != ItemToRender && itemstack1.ItemID == ItemToRender.ItemID && itemstack1.GetItemDamage() == ItemToRender.GetItemDamage()) { ItemToRender = itemstack1; flag = true; } float f = 0.4F; float f1 = flag ? 1.0F : 0.0F; float f2 = f1 - EquippedProgress; if (f2 < -f) { f2 = -f; } if (f2 > f) { f2 = f; } EquippedProgress += f2; if (EquippedProgress < 0.1F) { ItemToRender = itemstack1; EquippedItemSlot = ((EntityPlayer)(entityplayersp)).Inventory.CurrentItem; } }
public override void HandleFlying(Packet10Flying par1Packet10Flying) { EntityPlayerSP entityplayersp = Mc.ThePlayer; float d = ((EntityPlayer)(entityplayersp)).PosX; float d1 = ((EntityPlayer)(entityplayersp)).PosY; float d2 = ((EntityPlayer)(entityplayersp)).PosZ; float f = ((EntityPlayer)(entityplayersp)).RotationYaw; float f1 = ((EntityPlayer)(entityplayersp)).RotationPitch; if (par1Packet10Flying.Moving) { d = (float)par1Packet10Flying.XPosition; d1 = (float)par1Packet10Flying.YPosition; d2 = (float)par1Packet10Flying.ZPosition; } if (par1Packet10Flying.Rotating) { f = par1Packet10Flying.Yaw; f1 = par1Packet10Flying.Pitch; } entityplayersp.YSize = 0.0F; entityplayersp.MotionX = entityplayersp.MotionY = entityplayersp.MotionZ = 0.0F; entityplayersp.SetPositionAndRotation(d, d1, d2, f, f1); par1Packet10Flying.XPosition = ((EntityPlayer)(entityplayersp)).PosX; par1Packet10Flying.YPosition = ((EntityPlayer)(entityplayersp)).BoundingBox.MinY; par1Packet10Flying.ZPosition = ((EntityPlayer)(entityplayersp)).PosZ; par1Packet10Flying.Stance = ((EntityPlayer)(entityplayersp)).PosY; NetManager.AddToSendQueue(par1Packet10Flying); if (!Field_1210_g) { Mc.ThePlayer.PrevPosX = Mc.ThePlayer.PosX; Mc.ThePlayer.PrevPosY = Mc.ThePlayer.PosY; Mc.ThePlayer.PrevPosZ = Mc.ThePlayer.PosZ; Field_1210_g = true; Mc.DisplayGuiScreen(null); } }
public override void HandleOpenWindow(Packet100OpenWindow par1Packet100OpenWindow) { EntityPlayerSP entityplayersp = Mc.ThePlayer; switch (par1Packet100OpenWindow.InventoryType) { case 0: entityplayersp.DisplayGUIChest(new InventoryBasic(par1Packet100OpenWindow.WindowTitle, par1Packet100OpenWindow.SlotsCount)); entityplayersp.CraftingInventory.WindowId = par1Packet100OpenWindow.WindowId; break; case 2: entityplayersp.DisplayGUIFurnace(new TileEntityFurnace()); entityplayersp.CraftingInventory.WindowId = par1Packet100OpenWindow.WindowId; break; case 5: entityplayersp.DisplayGUIBrewingStand(new TileEntityBrewingStand()); entityplayersp.CraftingInventory.WindowId = par1Packet100OpenWindow.WindowId; break; case 3: entityplayersp.DisplayGUIDispenser(new TileEntityDispenser()); entityplayersp.CraftingInventory.WindowId = par1Packet100OpenWindow.WindowId; break; case 1: entityplayersp.DisplayWorkbenchGUI(MathHelper2.Floor_double(entityplayersp.PosX), MathHelper2.Floor_double(entityplayersp.PosY), MathHelper2.Floor_double(entityplayersp.PosZ)); entityplayersp.CraftingInventory.WindowId = par1Packet100OpenWindow.WindowId; break; case 4: entityplayersp.DisplayGUIEnchantment(MathHelper2.Floor_double(entityplayersp.PosX), MathHelper2.Floor_double(entityplayersp.PosY), MathHelper2.Floor_double(entityplayersp.PosZ)); entityplayersp.CraftingInventory.WindowId = par1Packet100OpenWindow.WindowId; break; } }
public override void HandleSetSlot(Packet103SetSlot par1Packet103SetSlot) { EntityPlayerSP entityplayersp = Mc.ThePlayer; if (par1Packet103SetSlot.WindowId == -1) { entityplayersp.Inventory.SetItemStack(par1Packet103SetSlot.MyItemStack); } else if (par1Packet103SetSlot.WindowId == 0 && par1Packet103SetSlot.ItemSlot >= 36 && par1Packet103SetSlot.ItemSlot < 45) { ItemStack itemstack = entityplayersp.InventorySlots.GetSlot(par1Packet103SetSlot.ItemSlot).GetStack(); if (par1Packet103SetSlot.MyItemStack != null && (itemstack == null || itemstack.StackSize < par1Packet103SetSlot.MyItemStack.StackSize)) { par1Packet103SetSlot.MyItemStack.AnimationsToGo = 5; } entityplayersp.InventorySlots.PutStackInSlot(par1Packet103SetSlot.ItemSlot, par1Packet103SetSlot.MyItemStack); } else if (par1Packet103SetSlot.WindowId == entityplayersp.CraftingInventory.WindowId) { entityplayersp.CraftingInventory.PutStackInSlot(par1Packet103SetSlot.ItemSlot, par1Packet103SetSlot.MyItemStack); } }
/// <summary> /// Renders the active item in the player's hand when in first person mode. Args: partialTickTime /// </summary> public virtual void RenderItemInFirstPerson(float par1) { float f = PrevEquippedProgress + (EquippedProgress - PrevEquippedProgress) * par1; EntityPlayerSP entityplayersp = Mc.ThePlayer; float f1 = ((EntityPlayer)(entityplayersp)).PrevRotationPitch + (((EntityPlayer)(entityplayersp)).RotationPitch - ((EntityPlayer)(entityplayersp)).PrevRotationPitch) * par1; //GL.PushMatrix(); //GL.Rotate(f1, 1.0F, 0.0F, 0.0F); //GL.Rotate(((EntityPlayer)(entityplayersp)).PrevRotationYaw + (((EntityPlayer)(entityplayersp)).RotationYaw - ((EntityPlayer)(entityplayersp)).PrevRotationYaw) * par1, 0.0F, 1.0F, 0.0F); RenderHelper.EnableStandardItemLighting(); //GL.PopMatrix(); if (entityplayersp is EntityPlayerSP) { EntityPlayerSP entityplayersp1 = (EntityPlayerSP)entityplayersp; float f2 = entityplayersp1.PrevRenderArmPitch + (entityplayersp1.RenderArmPitch - entityplayersp1.PrevRenderArmPitch) * par1; float f4 = entityplayersp1.PrevRenderArmYaw + (entityplayersp1.RenderArmYaw - entityplayersp1.PrevRenderArmYaw) * par1; //GL.Rotate((((EntityPlayer)(entityplayersp)).RotationPitch - f2) * 0.1F, 1.0F, 0.0F, 0.0F); //GL.Rotate((((EntityPlayer)(entityplayersp)).RotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F); } ItemStack itemstack = ItemToRender; float f3 = Mc.TheWorld.GetLightBrightness(MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosX), MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosY), MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosZ)); f3 = 1.0F; int i = Mc.TheWorld.GetLightBrightnessForSkyBlocks(MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosX), MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosY), MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosZ), 0); int k = i % 0x10000; int l = i / 0x10000; OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); if (itemstack != null) { int j = Item.ItemsList[itemstack.ItemID].GetColorFromDamage(itemstack.GetItemDamage(), 0); float f8 = (float)(j >> 16 & 0xff) / 255F; float f13 = (float)(j >> 8 & 0xff) / 255F; float f19 = (float)(j & 0xff) / 255F; //GL.Color4(f3 * f8, f3 * f13, f3 * f19, 1.0F); } else { //GL.Color4(f3, f3, f3, 1.0F); } if (itemstack != null && itemstack.ItemID == Item.Map.ShiftedIndex) { //GL.PushMatrix(); // float f5 = 0.8F; float f9 = entityplayersp.GetSwingProgress(par1); float f14 = MathHelper2.Sin(f9 * (float)Math.PI); float f20 = MathHelper2.Sin(MathHelper2.Sqrt_float(f9) * (float)Math.PI); //GL.Translate(-f20 * 0.4F, MathHelper.Sin(MathHelper.Sqrt_float(f9) * (float)Math.PI * 2.0F) * 0.2F, -f14 * 0.2F); f9 = (1.0F - f1 / 45F) + 0.1F; if (f9 < 0.0F) { f9 = 0.0F; } if (f9 > 1.0F) { f9 = 1.0F; } f9 = -MathHelper2.Cos(f9 * (float)Math.PI) * 0.5F + 0.5F; //GL.Translate(0.0F, (0.0F * f5 - (1.0F - f) * 1.2F - f9 * 0.5F) + 0.04F, -0.9F * f5); //GL.Rotate(90F, 0.0F, 1.0F, 0.0F); //GL.Rotate(f9 * -85F, 0.0F, 0.0F, 1.0F); //GL.Enable(EnableCap.RescaleNormal); //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTextureForDownloadableImage(Mc.ThePlayer.SkinUrl, Mc.ThePlayer.GetTexture())); for (f14 = 0; f14 < 2; f14++) { f20 = f14 * 2 - 1; //GL.PushMatrix(); //GL.Translate(-0F, -0.6F, 1.1F * (float)f20); //GL.Rotate(-45 * f20, 1.0F, 0.0F, 0.0F); //GL.Rotate(-90F, 0.0F, 0.0F, 1.0F); //GL.Rotate(59F, 0.0F, 0.0F, 1.0F); //GL.Rotate(-65 * f20, 0.0F, 1.0F, 0.0F); Render render1 = RenderManager.Instance.GetEntityRenderObject(Mc.ThePlayer); RenderPlayer renderplayer1 = (RenderPlayer)render1; // float f34 = 1.0F; //GL.Scale(f34, f34, f34); renderplayer1.DrawFirstPersonHand(); //GL.PopMatrix(); } f14 = entityplayersp.GetSwingProgress(par1); f20 = MathHelper2.Sin(f14 * f14 * (float)Math.PI); float f27 = MathHelper2.Sin(MathHelper2.Sqrt_float(f14) * (float)Math.PI); //GL.Rotate(-f20 * 20F, 0.0F, 1.0F, 0.0F); //GL.Rotate(-f27 * 20F, 0.0F, 0.0F, 1.0F); //GL.Rotate(-f27 * 80F, 1.0F, 0.0F, 0.0F); f14 = 0.38F; //GL.Scale(f14, f14, f14); //GL.Rotate(90F, 0.0F, 1.0F, 0.0F); //GL.Rotate(180F, 0.0F, 0.0F, 1.0F); //GL.Translate(-1F, -1F, 0.0F); f20 = 0.015625F; //GL.Scale(f20, f20, f20); Mc.RenderEngineOld.BindTexture(Mc.RenderEngineOld.GetTexture("/misc/mapbg.png")); Tessellator tessellator = Tessellator.Instance; //GL.Normal3(0.0F, 0.0F, -1F); tessellator.StartDrawingQuads(); sbyte byte0 = 7; tessellator.AddVertexWithUV(0 - byte0, 128 + byte0, 0.0F, 0.0F, 1.0D); tessellator.AddVertexWithUV(128 + byte0, 128 + byte0, 0.0F, 1.0D, 1.0D); tessellator.AddVertexWithUV(128 + byte0, 0 - byte0, 0.0F, 1.0D, 0.0F); tessellator.AddVertexWithUV(0 - byte0, 0 - byte0, 0.0F, 0.0F, 0.0F); tessellator.Draw(); MapData mapdata = Item.Map.GetMapData(itemstack, Mc.TheWorld); MapItemRenderer.RenderMap(Mc.ThePlayer, Mc.RenderEngineOld, mapdata); //GL.PopMatrix(); } else if (itemstack != null) { //GL.PushMatrix(); // float f6 = 0.8F; if (entityplayersp.GetItemInUseCount() > 0) { EnumAction enumaction = itemstack.GetItemUseAction(); if (enumaction == EnumAction.Eat || enumaction == EnumAction.Drink) { float f15 = ((float)entityplayersp.GetItemInUseCount() - par1) + 1.0F; float f21 = 1.0F - f15 / (float)itemstack.GetMaxItemUseDuration(); float f28 = f21; float f31 = 1.0F - f28; f31 = f31 * f31 * f31; f31 = f31 * f31 * f31; f31 = f31 * f31 * f31; float f35 = 1.0F - f31; //GL.Translate(0.0F, MathHelper.Abs(MathHelper.Cos((f15 / 4F) * (float)Math.PI) * 0.1F) * (float)((double)f28 <= 0.20000000000000001D ? 0 : 1), 0.0F); //GL.Translate(f35 * 0.6F, -f35 * 0.5F, 0.0F); //GL.Rotate(f35 * 90F, 0.0F, 1.0F, 0.0F); //GL.Rotate(f35 * 10F, 1.0F, 0.0F, 0.0F); //GL.Rotate(f35 * 30F, 0.0F, 0.0F, 1.0F); } } else { float f10 = entityplayersp.GetSwingProgress(par1); float f16 = MathHelper2.Sin(f10 * (float)Math.PI); float f22 = MathHelper2.Sin(MathHelper2.Sqrt_float(f10) * (float)Math.PI); //GL.Translate(-f22 * 0.4F, MathHelper.Sin(MathHelper.Sqrt_float(f10) * (float)Math.PI * 2.0F) * 0.2F, -f16 * 0.2F); } //GL.Translate(0.7F * f6, -0.65F * f6 - (1.0F - f) * 0.6F, -0.9F * f6); //GL.Rotate(45F, 0.0F, 1.0F, 0.0F); //GL.Enable(EnableCap.RescaleNormal); float f11 = entityplayersp.GetSwingProgress(par1); float f17 = MathHelper2.Sin(f11 * f11 * (float)Math.PI); float f23 = MathHelper2.Sin(MathHelper2.Sqrt_float(f11) * (float)Math.PI); //GL.Rotate(-f17 * 20F, 0.0F, 1.0F, 0.0F); //GL.Rotate(-f23 * 20F, 0.0F, 0.0F, 1.0F); //GL.Rotate(-f23 * 80F, 1.0F, 0.0F, 0.0F); f11 = 0.4F; //GL.Scale(f11, f11, f11); if (entityplayersp.GetItemInUseCount() > 0) { EnumAction enumaction1 = itemstack.GetItemUseAction(); if (enumaction1 == EnumAction.Block) { //GL.Translate(-0.5F, 0.2F, 0.0F); //GL.Rotate(30F, 0.0F, 1.0F, 0.0F); //GL.Rotate(-80F, 1.0F, 0.0F, 0.0F); //GL.Rotate(60F, 0.0F, 1.0F, 0.0F); } else if (enumaction1 == EnumAction.Bow) { //GL.Rotate(-18F, 0.0F, 0.0F, 1.0F); //GL.Rotate(-12F, 0.0F, 1.0F, 0.0F); //GL.Rotate(-8F, 1.0F, 0.0F, 0.0F); //GL.Translate(-0.9F, 0.2F, 0.0F); float f24 = (float)itemstack.GetMaxItemUseDuration() - (((float)entityplayersp.GetItemInUseCount() - par1) + 1.0F); float f29 = f24 / 20F; f29 = (f29 * f29 + f29 * 2.0F) / 3F; if (f29 > 1.0F) { f29 = 1.0F; } if (f29 > 0.1F) { //GL.Translate(0.0F, MathHelper.Sin((f24 - 0.1F) * 1.3F) * 0.01F * (f29 - 0.1F), 0.0F); } //GL.Translate(0.0F, 0.0F, f29 * 0.1F); //GL.Rotate(-335F, 0.0F, 0.0F, 1.0F); //GL.Rotate(-50F, 0.0F, 1.0F, 0.0F); //GL.Translate(0.0F, 0.5F, 0.0F); float f32 = 1.0F + f29 * 0.2F; //GL.Scale(1.0F, 1.0F, f32); //GL.Translate(0.0F, -0.5F, 0.0F); //GL.Rotate(50F, 0.0F, 1.0F, 0.0F); //GL.Rotate(335F, 0.0F, 0.0F, 1.0F); } } if (itemstack.GetItem().ShouldRotateAroundWhenRendering()) { //GL.Rotate(180F, 0.0F, 1.0F, 0.0F); } if (itemstack.GetItem().Func_46058_c()) { RenderItem(entityplayersp, itemstack, 0); int i1 = Item.ItemsList[itemstack.ItemID].GetColorFromDamage(itemstack.GetItemDamage(), 1); float f25 = (float)(i1 >> 16 & 0xff) / 255F; float f30 = (float)(i1 >> 8 & 0xff) / 255F; float f33 = (float)(i1 & 0xff) / 255F; //GL.Color4(f3 * f25, f3 * f30, f3 * f33, 1.0F); RenderItem(entityplayersp, itemstack, 1); } else { RenderItem(entityplayersp, itemstack, 0); } //GL.PopMatrix(); } else { //GL.PushMatrix(); // float f7 = 0.8F; float f12 = entityplayersp.GetSwingProgress(par1); float f18 = MathHelper2.Sin(f12 * (float)Math.PI); float f26 = MathHelper2.Sin(MathHelper2.Sqrt_float(f12) * (float)Math.PI); //GL.Translate(-f26 * 0.3F, MathHelper.Sin(MathHelper.Sqrt_float(f12) * (float)Math.PI * 2.0F) * 0.4F, -f18 * 0.4F); //GL.Translate(0.8F * f7, -0.75F * f7 - (1.0F - f) * 0.6F, -0.9F * f7); //GL.Rotate(45F, 0.0F, 1.0F, 0.0F); //GL.Enable(EnableCap.RescaleNormal); f12 = entityplayersp.GetSwingProgress(par1); f18 = MathHelper2.Sin(f12 * f12 * (float)Math.PI); f26 = MathHelper2.Sin(MathHelper2.Sqrt_float(f12) * (float)Math.PI); //GL.Rotate(f26 * 70F, 0.0F, 1.0F, 0.0F); //GL.Rotate(-f18 * 20F, 0.0F, 0.0F, 1.0F); //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTextureForDownloadableImage(Mc.ThePlayer.SkinUrl, Mc.ThePlayer.GetTexture())); //GL.Translate(-1F, 3.6F, 3.5F); //GL.Rotate(120F, 0.0F, 0.0F, 1.0F); //GL.Rotate(200F, 1.0F, 0.0F, 0.0F); //GL.Rotate(-135F, 0.0F, 1.0F, 0.0F); //GL.Scale(1.0F, 1.0F, 1.0F); //GL.Translate(5.6F, 0.0F, 0.0F); Render render = RenderManager.Instance.GetEntityRenderObject(Mc.ThePlayer); RenderPlayer renderplayer = (RenderPlayer)render; f26 = 1.0F; //GL.Scale(f26, f26, f26); renderplayer.DrawFirstPersonHand(); //GL.PopMatrix(); } //GL.Disable(EnableCap.RescaleNormal); RenderHelper.DisableStandardItemLighting(); }