/// <summary>
        /// Callback for when the crafting gui is closed.
        /// </summary>
        public virtual void OnCraftGuiClosed(EntityPlayer par1EntityPlayer)
        {
            InventoryPlayer inventoryplayer = par1EntityPlayer.Inventory;

            if (inventoryplayer.GetItemStack() != null)
            {
                par1EntityPlayer.DropPlayerItem(inventoryplayer.GetItemStack());
                inventoryplayer.SetItemStack(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Returns the modifier of protection enchantments on armors equipped on player.
        /// </summary>
        public static int GetEnchantmentModifierDamage(InventoryPlayer par0InventoryPlayer, DamageSource par1DamageSource)
        {
            EnchantmentModifierDamage.DamageModifier = 0;
            EnchantmentModifierDamage.DamageSource   = par1DamageSource;
            ApplyEnchantmentModifierArray(EnchantmentModifierDamage, par0InventoryPlayer.ArmorInventory);

            if (EnchantmentModifierDamage.DamageModifier > 25)
            {
                EnchantmentModifierDamage.DamageModifier = 25;
            }

            return((EnchantmentModifierDamage.DamageModifier + 1 >> 1) + EnchantmentRand.Next((EnchantmentModifierDamage.DamageModifier >> 1) + 1));
        }
Esempio n. 3
0
        /// <summary>
        /// Return the (magic) extra damage of the enchantments on player equipped item.
        /// </summary>
        public static int GetEnchantmentModifierLiving(InventoryPlayer par0InventoryPlayer, EntityLiving par1EntityLiving)
        {
            EnchantmentModifierLiving.LivingModifier = 0;
            EnchantmentModifierLiving.EntityLiving   = par1EntityLiving;
            ApplyEnchantmentModifier(EnchantmentModifierLiving, par0InventoryPlayer.GetCurrentItem());

            if (EnchantmentModifierLiving.LivingModifier > 0)
            {
                return(1 + EnchantmentRand.Next(EnchantmentModifierLiving.LivingModifier));
            }
            else
            {
                return(0);
            }
        }
Esempio n. 4
0
        public ContainerEnchantment(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
        {
            TableInventory = new SlotEnchantmentTable(this, "Enchant", 1);
            Rand           = new Random();
            EnchantLevels  = new int[3];
            WorldPointer   = par2World;
            PosX           = par3;
            PosY           = par4;
            PosZ           = par5;
            AddSlot(new SlotEnchantment(this, TableInventory, 0, 25, 47));

            for (int i = 0; i < 3; i++)
            {
                for (int k = 0; k < 9; k++)
                {
                    AddSlot(new Slot(par1InventoryPlayer, k + i * 9 + 9, 8 + k * 18, 84 + i * 18));
                }
            }

            for (int j = 0; j < 9; j++)
            {
                AddSlot(new Slot(par1InventoryPlayer, j, 8 + j * 18, 142));
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Returns the 'Water Breathing' modifier of enchantments on player equipped armors.
 /// </summary>
 public static int GetRespiration(InventoryPlayer par0InventoryPlayer)
 {
     return(GetMaxEnchantmentLevel(Enchantment.Respiration.EffectId, par0InventoryPlayer.ArmorInventory));
 }
Esempio n. 6
0
 /// <summary>
 /// Return the fire aspect value of enchantments on equipped player item.
 /// </summary>
 public static int GetFireAspectModifier(InventoryPlayer par0InventoryPlayer, EntityLiving par1EntityLiving)
 {
     return(GetEnchantmentLevel(Enchantment.FireAspect.EffectId, par0InventoryPlayer.GetCurrentItem()));
 }
        /// <summary>
        /// Draws the screen and all the components in it.
        /// </summary>
        public override void DrawScreen(int par1, int par2, float par3)
        {
            DrawDefaultBackground();
            int i = GuiLeft;
            int j = GuiTop;

            DrawGuiContainerBackgroundLayer(par3, par1, par2);
            RenderHelper.EnableGUIStandardItemLighting();
            //GL.PushMatrix();
            //GL.Translate(i, j, 0.0F);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            //GL.Enable(EnableCap.RescaleNormal);
            Slot slot = null;
            int  k    = 240;
            int  i1   = 240;

            OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)k / 1.0F, (float)i1 / 1.0F);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);

            for (int l = 0; l < InventorySlots.InventorySlots.Count; l++)
            {
                Slot slot1 = (Slot)InventorySlots.InventorySlots[l];
                DrawSlotInventory(slot1);

                if (IsMouseOverSlot(slot1, par1, par2))
                {
                    slot = slot1;
                    //GL.Disable(EnableCap.Lighting);
                    //GL.Disable(EnableCap.DepthTest);
                    int j1 = slot1.XDisplayPosition;
                    int k1 = slot1.YDisplayPosition;
                    DrawGradientRect(j1, k1, j1 + 16, k1 + 16, 0x80fffff, 0x80fffff);
                    //GL.Enable(EnableCap.Lighting);
                    //GL.Enable(EnableCap.DepthTest);
                }
            }

            DrawGuiContainerForegroundLayer();
            InventoryPlayer inventoryplayer = Mc.ThePlayer.Inventory;

            if (inventoryplayer.GetItemStack() != null)
            {
                //GL.Translate(0.0F, 0.0F, 32F);
                ZLevel = 200F;
                ItemRenderer.ZLevel = 200F;
                ItemRenderer.RenderItemIntoGUI(FontRenderer, Mc.RenderEngineOld, inventoryplayer.GetItemStack(), par1 - i - 8, par2 - j - 8);
                ItemRenderer.RenderItemOverlayIntoGUI(FontRenderer, Mc.RenderEngineOld, inventoryplayer.GetItemStack(), par1 - i - 8, par2 - j - 8);
                ZLevel = 0.0F;
                ItemRenderer.ZLevel = 0.0F;
            }

            //GL.Disable(EnableCap.RescaleNormal);
            RenderHelper.DisableStandardItemLighting();
            //GL.Disable(EnableCap.Lighting);
            //GL.Disable(EnableCap.DepthTest);

            if (inventoryplayer.GetItemStack() == null && slot != null && slot.GetHasStack())
            {
                ItemStack     itemstack = slot.GetStack();
                List <string> list      = itemstack.GetItemNameandInformation();

                if (list.Count > 0)
                {
                    int l1 = 0;

                    for (int i2 = 0; i2 < list.Count; i2++)
                    {
                        int k2 = FontRenderer.GetStringWidth(list[i2]);

                        if (k2 > l1)
                        {
                            l1 = k2;
                        }
                    }

                    int j2 = (par1 - i) + 12;
                    int l2 = par2 - j - 12;
                    int i3 = l1;
                    int j3 = 8;

                    if (list.Count > 1)
                    {
                        j3 += 2 + (list.Count - 1) * 10;
                    }

                    ZLevel = 300F;
                    ItemRenderer.ZLevel = 300F;
                    int k3 = 0xf010001;
                    DrawGradientRect(j2 - 3, l2 - 4, j2 + i3 + 3, l2 - 3, k3, k3);
                    DrawGradientRect(j2 - 3, l2 + j3 + 3, j2 + i3 + 3, l2 + j3 + 4, k3, k3);
                    DrawGradientRect(j2 - 3, l2 - 3, j2 + i3 + 3, l2 + j3 + 3, k3, k3);
                    DrawGradientRect(j2 - 4, l2 - 3, j2 - 3, l2 + j3 + 3, k3, k3);
                    DrawGradientRect(j2 + i3 + 3, l2 - 3, j2 + i3 + 4, l2 + j3 + 3, k3, k3);
                    int l3 = 0x505000ff;
                    int i4 = (l3 & 0xfefefe) >> 1 | l3 & 0xff00000;
                    DrawGradientRect(j2 - 3, (l2 - 3) + 1, (j2 - 3) + 1, (l2 + j3 + 3) - 1, l3, i4);
                    DrawGradientRect(j2 + i3 + 2, (l2 - 3) + 1, j2 + i3 + 3, (l2 + j3 + 3) - 1, l3, i4);
                    DrawGradientRect(j2 - 3, l2 - 3, j2 + i3 + 3, (l2 - 3) + 1, l3, l3);
                    DrawGradientRect(j2 - 3, l2 + j3 + 2, j2 + i3 + 3, l2 + j3 + 3, i4, i4);

                    for (int j4 = 0; j4 < list.Count; j4++)
                    {
                        string s = list[j4];

                        if (j4 == 0)
                        {
                            //s = (new StringBuilder()).Append((char)0xa7).Append(int.ToHexString(itemstack.GetRarity().NameColor)).Append(s).ToString();
                        }
                        else
                        {
                            s = (new StringBuilder()).Append((char)0xa7).Append(s).ToString();
                        }

                        FontRenderer.DrawStringWithShadow(s, j2, l2, -1);

                        if (j4 == 0)
                        {
                            l2 += 2;
                        }

                        l2 += 10;
                    }

                    ZLevel = 0.0F;
                    ItemRenderer.ZLevel = 0.0F;
                }
            }

            //GL.PopMatrix();
            base.DrawScreen(par1, par2, par3);
            //GL.Enable(EnableCap.Lighting);
            //GL.Enable(EnableCap.DepthTest);
        }
        public ContainerCreative(EntityPlayer par1EntityPlayer)
        {
            ItemList = new List <ItemStack>();
            Block[] ablock = { Block.Cobblestone, Block.Stone, Block.OreDiamond, Block.OreGold, Block.OreIron, Block.OreCoal, Block.OreLapis, Block.OreRedstone, Block.StoneBrick, Block.StoneBrick, Block.StoneBrick, Block.StoneBrick, Block.BlockClay, Block.BlockDiamond, Block.BlockGold, Block.BlockSteel, Block.Bedrock, Block.BlockLapis, Block.Brick, Block.CobblestoneMossy, Block.StairSingle, Block.StairSingle, Block.StairSingle, Block.StairSingle, Block.StairSingle, Block.StairSingle, Block.Obsidian, Block.Netherrack, Block.SlowSand, Block.GlowStone, Block.Wood, Block.Wood, Block.Wood, Block.Wood, Block.Leaves, Block.Leaves, Block.Leaves, Block.Leaves, Block.Dirt, Block.Grass, Block.Sand, Block.SandStone, Block.SandStone, Block.SandStone, Block.Gravel, Block.Web, Block.Planks, Block.Planks, Block.Planks, Block.Planks, Block.Sapling, Block.Sapling, Block.Sapling, Block.Sapling, Block.DeadBush, Block.Sponge, Block.Ice, Block.BlockSnow, Block.PlantYellow, Block.PlantRed, Block.MushroomBrown, Block.MushroomRed, Block.Cactus, Block.Melon, Block.Pumpkin, Block.PumpkinLantern, Block.Vine, Block.FenceIron, Block.ThinGlass, Block.NetherBrick, Block.NetherFence, Block.StairsNetherBrick, Block.WhiteStone, Block.Mycelium, Block.Waterlily, Block.TallGrass, Block.TallGrass, Block.Chest, Block.Workbench, Block.Glass, Block.Tnt, Block.BookShelf, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Cloth, Block.Dispenser, Block.StoneOvenIdle, Block.Music, Block.Jukebox, Block.PistonStickyBase, Block.PistonBase, Block.Fence, Block.FenceGate, Block.Ladder, Block.Rail, Block.RailPowered, Block.RailDetector, Block.TorchWood, Block.StairCompactPlanks, Block.StairCompactCobblestone, Block.StairsBrick, Block.StairsStoneBrickSmooth, Block.Lever, Block.PressurePlateStone, Block.PressurePlatePlanks, Block.TorchRedstoneActive, Block.Button, Block.Trapdoor, Block.EnchantmentTable, Block.RedstoneLampIdle };
            int     i      = 0;
            int     j      = 0;
            int     k      = 0;
            int     l      = 0;
            int     i1     = 0;
            int     j1     = 0;
            int     k1     = 0;
            int     l1     = 0;
            int     i2     = 1;

            for (int j2 = 0; j2 < ablock.Length; j2++)
            {
                int i3 = 0;

                if (ablock[j2] == Block.Cloth)
                {
                    i3 = i++;
                }
                else if (ablock[j2] == Block.StairSingle)
                {
                    i3 = j++;
                }
                else if (ablock[j2] == Block.Wood)
                {
                    i3 = k++;
                }
                else if (ablock[j2] == Block.Planks)
                {
                    i3 = l++;
                }
                else if (ablock[j2] == Block.Sapling)
                {
                    i3 = i1++;
                }
                else if (ablock[j2] == Block.StoneBrick)
                {
                    i3 = j1++;
                }
                else if (ablock[j2] == Block.SandStone)
                {
                    i3 = k1++;
                }
                else if (ablock[j2] == Block.TallGrass)
                {
                    i3 = i2++;
                }
                else if (ablock[j2] == Block.Leaves)
                {
                    i3 = l1++;
                }

                ItemList.Add(new ItemStack(ablock[j2], 1, i3));
            }

            for (int k2 = 256; k2 < Item.ItemsList.Length; k2++)
            {
                if (Item.ItemsList[k2] != null && Item.ItemsList[k2].ShiftedIndex != Item.Potion.ShiftedIndex && Item.ItemsList[k2].ShiftedIndex != Item.MonsterPlacer.ShiftedIndex)
                {
                    ItemList.Add(new ItemStack(Item.ItemsList[k2]));
                }
            }

            for (int l2 = 1; l2 < 16; l2++)
            {
                ItemList.Add(new ItemStack(Item.DyePowder.ShiftedIndex, 1, l2));
            }

            int integer;

            for (IEnumerator <int> iterator = EntityList.EntityEggs.Keys.GetEnumerator(); iterator.MoveNext(); ItemList.Add(new ItemStack(Item.MonsterPlacer.ShiftedIndex, 1, integer)))
            {
                integer = iterator.Current;
            }

            InventoryPlayer inventoryplayer = par1EntityPlayer.Inventory;

            for (int j3 = 0; j3 < 9; j3++)
            {
                for (int l3 = 0; l3 < 8; l3++)
                {
                    AddSlot(new Slot(GuiContainerCreative.GetInventory(), l3 + j3 * 8, 8 + l3 * 18, 18 + j3 * 18));
                }
            }

            for (int k3 = 0; k3 < 9; k3++)
            {
                AddSlot(new Slot(inventoryplayer, k3, 8 + k3 * 18, 184));
            }

            ScrollTo(0.0F);
        }
Esempio n. 9
0
 /// <summary>
 /// Returns the looting enchantment modifier of the current equipped item of player.
 /// </summary>
 public static int GetLootingModifier(InventoryPlayer par0InventoryPlayer)
 {
     return(GetEnchantmentLevel(Enchantment.Looting.EffectId, par0InventoryPlayer.GetCurrentItem()));
 }
Esempio n. 10
0
 public GuiEnchantment(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5) : base(new ContainerEnchantment(par1InventoryPlayer, par2World, par3, par4, par5))
 {
     Field_40230_x        = new Random();
     ContainerEnchantment = (ContainerEnchantment)InventorySlots;
 }
Esempio n. 11
0
        protected override void HandleMouseClick(Slot par1Slot, int par2, int par3, bool par4)
        {
            if (par1Slot != null)
            {
                if (par1Slot.Inventory == Inventory)
                {
                    InventoryPlayer inventoryplayer = Mc.ThePlayer.Inventory;
                    ItemStack       itemstack1      = inventoryplayer.GetItemStack();
                    ItemStack       itemstack4      = par1Slot.GetStack();

                    if (itemstack1 != null && itemstack4 != null && itemstack1.ItemID == itemstack4.ItemID)
                    {
                        if (par3 == 0)
                        {
                            if (par4)
                            {
                                itemstack1.StackSize = itemstack1.GetMaxStackSize();
                            }
                            else if (itemstack1.StackSize < itemstack1.GetMaxStackSize())
                            {
                                itemstack1.StackSize++;
                            }
                        }
                        else if (itemstack1.StackSize <= 1)
                        {
                            inventoryplayer.SetItemStack(null);
                        }
                        else
                        {
                            itemstack1.StackSize--;
                        }
                    }
                    else if (itemstack1 != null)
                    {
                        inventoryplayer.SetItemStack(null);
                    }
                    else if (itemstack4 == null)
                    {
                        inventoryplayer.SetItemStack(null);
                    }
                    else if (itemstack1 == null || itemstack1.ItemID != itemstack4.ItemID)
                    {
                        inventoryplayer.SetItemStack(ItemStack.CopyItemStack(itemstack4));
                        ItemStack itemstack2 = inventoryplayer.GetItemStack();

                        if (par4)
                        {
                            itemstack2.StackSize = itemstack2.GetMaxStackSize();
                        }
                    }
                }
                else
                {
                    InventorySlots.SlotClick(par1Slot.SlotNumber, par3, par4, Mc.ThePlayer);
                    ItemStack itemstack = InventorySlots.GetSlot(par1Slot.SlotNumber).GetStack();
                    Mc.PlayerController.SendSlotPacket(itemstack, (par1Slot.SlotNumber - InventorySlots.InventorySlots.Count) + 9 + 36);
                }
            }
            else
            {
                InventoryPlayer inventoryplayer1 = Mc.ThePlayer.Inventory;

                if (inventoryplayer1.GetItemStack() != null)
                {
                    if (par3 == 0)
                    {
                        Mc.ThePlayer.DropPlayerItem(inventoryplayer1.GetItemStack());
                        Mc.PlayerController.Func_35639_a(inventoryplayer1.GetItemStack());
                        inventoryplayer1.SetItemStack(null);
                    }

                    if (par3 == 1)
                    {
                        ItemStack itemstack3 = inventoryplayer1.GetItemStack().SplitStack(1);
                        Mc.ThePlayer.DropPlayerItem(itemstack3);
                        Mc.PlayerController.Func_35639_a(itemstack3);

                        if (inventoryplayer1.GetItemStack().StackSize == 0)
                        {
                            inventoryplayer1.SetItemStack(null);
                        }
                    }
                }
            }
        }
Esempio n. 12
0
 public GuiCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5) : base(new ContainerWorkbench(par1InventoryPlayer, par2World, par3, par4, par5))
 {
 }
Esempio n. 13
0
 public GuiBrewingStand(InventoryPlayer par1InventoryPlayer, TileEntityBrewingStand par2TileEntityBrewingStand) : base(new ContainerBrewingStand(par1InventoryPlayer, par2TileEntityBrewingStand))
 {
     Field_40217_h = par2TileEntityBrewingStand;
 }
Esempio n. 14
0
 /// <summary>
 /// Returns the silk touch status of enchantments on current equipped item of player.
 /// </summary>
 public static bool GetSilkTouchModifier(InventoryPlayer par0InventoryPlayer)
 {
     return(GetEnchantmentLevel(Enchantment.SilkTouch.EffectId, par0InventoryPlayer.GetCurrentItem()) > 0);
 }
 /// <summary>
 /// Gets a unique transaction ID. Parameter is unused.
 /// </summary>
 public virtual short GetNextTransactionID(InventoryPlayer par1InventoryPlayer)
 {
     TransactionID++;
     return(TransactionID);
 }
Esempio n. 16
0
 /// <summary>
 /// Returns the fortune enchantment modifier of the current equipped item of player.
 /// </summary>
 public static int GetFortuneModifier(InventoryPlayer par0InventoryPlayer)
 {
     return(GetEnchantmentLevel(Enchantment.Fortune.EffectId, par0InventoryPlayer.GetCurrentItem()));
 }
        public virtual ItemStack SlotClick(int par1, int par2, bool par3, EntityPlayer par4EntityPlayer)
        {
            ItemStack itemstack = null;

            if (par2 > 1)
            {
                return(null);
            }

            if (par2 == 0 || par2 == 1)
            {
                InventoryPlayer inventoryplayer = par4EntityPlayer.Inventory;

                if (par1 == -999)
                {
                    if (inventoryplayer.GetItemStack() != null && par1 == -999)
                    {
                        if (par2 == 0)
                        {
                            par4EntityPlayer.DropPlayerItem(inventoryplayer.GetItemStack());
                            inventoryplayer.SetItemStack(null);
                        }

                        if (par2 == 1)
                        {
                            par4EntityPlayer.DropPlayerItem(inventoryplayer.GetItemStack().SplitStack(1));

                            if (inventoryplayer.GetItemStack().StackSize == 0)
                            {
                                inventoryplayer.SetItemStack(null);
                            }
                        }
                    }
                }
                else if (par3)
                {
                    ItemStack itemstack1 = TransferStackInSlot(par1);

                    if (itemstack1 != null)
                    {
                        int i = itemstack1.ItemID;
                        itemstack = itemstack1.Copy();
                        Slot slot1 = InventorySlots[par1];

                        if (slot1 != null && slot1.GetStack() != null && slot1.GetStack().ItemID == i)
                        {
                            RetrySlotClick(par1, par2, par3, par4EntityPlayer);
                        }
                    }
                }
                else
                {
                    if (par1 < 0)
                    {
                        return(null);
                    }

                    Slot slot = InventorySlots[par1];

                    if (slot != null)
                    {
                        slot.OnSlotChanged();
                        ItemStack itemstack2 = slot.GetStack();
                        ItemStack itemstack4 = inventoryplayer.GetItemStack();

                        if (itemstack2 != null)
                        {
                            itemstack = itemstack2.Copy();
                        }

                        if (itemstack2 == null)
                        {
                            if (itemstack4 != null && slot.IsItemValid(itemstack4))
                            {
                                int j = par2 != 0 ? 1 : itemstack4.StackSize;

                                if (j > slot.GetSlotStackLimit())
                                {
                                    j = slot.GetSlotStackLimit();
                                }

                                slot.PutStack(itemstack4.SplitStack(j));

                                if (itemstack4.StackSize == 0)
                                {
                                    inventoryplayer.SetItemStack(null);
                                }
                            }
                        }
                        else if (itemstack4 == null)
                        {
                            int       k          = par2 != 0 ? (itemstack2.StackSize + 1) / 2 : itemstack2.StackSize;
                            ItemStack itemstack6 = slot.DecrStackSize(k);
                            inventoryplayer.SetItemStack(itemstack6);

                            if (itemstack2.StackSize == 0)
                            {
                                slot.PutStack(null);
                            }

                            slot.OnPickupFromSlot(inventoryplayer.GetItemStack());
                        }
                        else if (slot.IsItemValid(itemstack4))
                        {
                            if (itemstack2.ItemID != itemstack4.ItemID || itemstack2.GetHasSubtypes() && itemstack2.GetItemDamage() != itemstack4.GetItemDamage() || !ItemStack.Func_46154_a(itemstack2, itemstack4))
                            {
                                if (itemstack4.StackSize <= slot.GetSlotStackLimit())
                                {
                                    ItemStack itemstack5 = itemstack2;
                                    slot.PutStack(itemstack4);
                                    inventoryplayer.SetItemStack(itemstack5);
                                }
                            }
                            else
                            {
                                int l = par2 != 0 ? 1 : itemstack4.StackSize;

                                if (l > slot.GetSlotStackLimit() - itemstack2.StackSize)
                                {
                                    l = slot.GetSlotStackLimit() - itemstack2.StackSize;
                                }

                                if (l > itemstack4.GetMaxStackSize() - itemstack2.StackSize)
                                {
                                    l = itemstack4.GetMaxStackSize() - itemstack2.StackSize;
                                }

                                itemstack4.SplitStack(l);

                                if (itemstack4.StackSize == 0)
                                {
                                    inventoryplayer.SetItemStack(null);
                                }

                                itemstack2.StackSize += l;
                            }
                        }
                        else if (itemstack2.ItemID == itemstack4.ItemID && itemstack4.GetMaxStackSize() > 1 && (!itemstack2.GetHasSubtypes() || itemstack2.GetItemDamage() == itemstack4.GetItemDamage()) && ItemStack.Func_46154_a(itemstack2, itemstack4))
                        {
                            int i1 = itemstack2.StackSize;

                            if (i1 > 0 && i1 + itemstack4.StackSize <= itemstack4.GetMaxStackSize())
                            {
                                itemstack4.StackSize += i1;
                                ItemStack itemstack3 = slot.DecrStackSize(i1);

                                if (itemstack3.StackSize == 0)
                                {
                                    slot.PutStack(null);
                                }

                                slot.OnPickupFromSlot(inventoryplayer.GetItemStack());
                            }
                        }
                    }
                }
            }

            return(itemstack);
        }
Esempio n. 18
0
 /// <summary>
 /// Returns the aqua affinity status of enchantments on current equipped item of player.
 /// </summary>
 public static bool GetAquaAffinityModifier(InventoryPlayer par0InventoryPlayer)
 {
     return(GetMaxEnchantmentLevel(Enchantment.AquaAffinity.EffectId, par0InventoryPlayer.ArmorInventory) > 0);
 }
Esempio n. 19
0
 public GuiDispenser(InventoryPlayer par1InventoryPlayer, TileEntityDispenser par2TileEntityDispenser) : base(new ContainerDispenser(par1InventoryPlayer, par2TileEntityDispenser))
 {
 }
Esempio n. 20
0
 public GuiFurnace(InventoryPlayer par1InventoryPlayer, TileEntityFurnace par2TileEntityFurnace) : base(new ContainerFurnace(par1InventoryPlayer, par2TileEntityFurnace))
 {
     FurnaceInventory = par2TileEntityFurnace;
 }
Esempio n. 21
0
        /// <summary>
        /// Render the ingame overlay with quick icon bar, ...
        /// </summary>
        public virtual void RenderGameOverlay(float par1, bool par2, int par3, int par4)
        {
            ScaledResolution scaledresolution = new ScaledResolution(mc.GameSettings, mc.DisplayWidth, mc.DisplayHeight);
            int          i            = scaledresolution.GetScaledWidth();
            int          j            = scaledresolution.GetScaledHeight();
            FontRenderer fontrenderer = mc.FontRenderer;

            mc.EntityRenderer.SetupOverlayRendering();
            //GL.Enable(EnableCap.Blend);

            if (Minecraft.IsFancyGraphicsEnabled())
            {
                RenderVignette(mc.ThePlayer.GetBrightness(par1), i, j);
            }
            else
            {
                //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            }

            ItemStack itemstack = mc.ThePlayer.Inventory.ArmorItemInSlot(3);

            if (mc.GameSettings.ThirdPersonView == 0 && itemstack != null && itemstack.ItemID == Block.Pumpkin.BlockID)
            {
                RenderPumpkinBlur(i, j);
            }

            if (!mc.ThePlayer.IsPotionActive(Potion.Confusion))
            {
                float f = mc.ThePlayer.PrevTimeInPortal + (mc.ThePlayer.TimeInPortal - mc.ThePlayer.PrevTimeInPortal) * par1;

                if (f > 0.0F)
                {
                    RenderPortalOverlay(f, i, j);
                }
            }

            if (!mc.PlayerController.Func_35643_e())
            {
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                //GL.BindTexture(TextureTarget.Texture2D, mc.RenderEngineOld.GetTexture("/gui/gui.png"));
                InventoryPlayer inventoryplayer = mc.ThePlayer.Inventory;
                ZLevel = -90F;
                DrawTexturedModalRect(i / 2 - 91, j - 22, 0, 0, 182, 22);
                DrawTexturedModalRect((i / 2 - 91 - 1) + inventoryplayer.CurrentItem * 20, j - 22 - 1, 0, 22, 24, 22);
                //GL.BindTexture(TextureTarget.Texture2D, mc.RenderEngineOld.GetTexture("/gui/icons.png"));
                //GL.Enable(EnableCap.Blend);
                //GL.BlendFunc(BlendingFactorSrc.OneMinusDstColor, BlendingFactorDest.OneMinusSrcColor);
                DrawTexturedModalRect(i / 2 - 7, j / 2 - 7, 0, 0, 16, 16);
                //GL.Disable(EnableCap.Blend);
                bool flag = (mc.ThePlayer.HeartsLife / 3) % 2 == 1;

                if (mc.ThePlayer.HeartsLife < 10)
                {
                    flag = false;
                }

                int i1 = mc.ThePlayer.GetHealth();
                int i2 = mc.ThePlayer.PrevHealth;
                rand.SetSeed(updateCounter * 0x4c627);
                bool      flag2     = false;
                FoodStats foodstats = mc.ThePlayer.GetFoodStats();
                int       j4        = foodstats.GetFoodLevel();
                int       l4        = foodstats.GetPrevFoodLevel();
                RenderBossHealth();

                if (mc.PlayerController.ShouldDrawHUD())
                {
                    int j5 = i / 2 - 91;
                    int i6 = i / 2 + 91;
                    int l6 = mc.ThePlayer.XpBarCap();

                    if (l6 > 0)
                    {
                        int c  = 0xb6;
                        int j8 = (int)(mc.ThePlayer.Experience * (float)(c + 1));
                        int i9 = (j - 32) + 3;
                        DrawTexturedModalRect(j5, i9, 0, 64, c, 5);

                        if (j8 > 0)
                        {
                            DrawTexturedModalRect(j5, i9, 0, 69, j8, 5);
                        }
                    }

                    int k7  = j - 39;
                    int k8  = k7 - 10;
                    int j9  = mc.ThePlayer.GetTotalArmorValue();
                    int i10 = -1;

                    if (mc.ThePlayer.IsPotionActive(Potion.Regeneration))
                    {
                        i10 = updateCounter % 25;
                    }

                    for (int j10 = 0; j10 < 10; j10++)
                    {
                        if (j9 > 0)
                        {
                            int i11 = j5 + j10 * 8;

                            if (j10 * 2 + 1 < j9)
                            {
                                DrawTexturedModalRect(i11, k8, 34, 9, 9, 9);
                            }

                            if (j10 * 2 + 1 == j9)
                            {
                                DrawTexturedModalRect(i11, k8, 25, 9, 9, 9);
                            }

                            if (j10 * 2 + 1 > j9)
                            {
                                DrawTexturedModalRect(i11, k8, 16, 9, 9, 9);
                            }
                        }

                        int j11 = 16;

                        if (mc.ThePlayer.IsPotionActive(Potion.Poison))
                        {
                            j11 += 36;
                        }

                        int i12 = 0;

                        if (flag)
                        {
                            i12 = 1;
                        }

                        int l12 = j5 + j10 * 8;
                        int j13 = k7;

                        if (i1 <= 4)
                        {
                            j13 += rand.Next(2);
                        }

                        if (j10 == i10)
                        {
                            j13 -= 2;
                        }

                        byte byte3 = 0;

                        if (mc.TheWorld.GetWorldInfo().IsHardcoreModeEnabled())
                        {
                            byte3 = 5;
                        }

                        DrawTexturedModalRect(l12, j13, 16 + i12 * 9, 9 * byte3, 9, 9);

                        if (flag)
                        {
                            if (j10 * 2 + 1 < i2)
                            {
                                DrawTexturedModalRect(l12, j13, j11 + 54, 9 * byte3, 9, 9);
                            }

                            if (j10 * 2 + 1 == i2)
                            {
                                DrawTexturedModalRect(l12, j13, j11 + 63, 9 * byte3, 9, 9);
                            }
                        }

                        if (j10 * 2 + 1 < i1)
                        {
                            DrawTexturedModalRect(l12, j13, j11 + 36, 9 * byte3, 9, 9);
                        }

                        if (j10 * 2 + 1 == i1)
                        {
                            DrawTexturedModalRect(l12, j13, j11 + 45, 9 * byte3, 9, 9);
                        }
                    }

                    for (int k10 = 0; k10 < 10; k10++)
                    {
                        int  k11   = k7;
                        int  j12   = 16;
                        byte byte2 = 0;

                        if (mc.ThePlayer.IsPotionActive(Potion.Hunger))
                        {
                            j12  += 36;
                            byte2 = 13;
                        }

                        if (mc.ThePlayer.GetFoodStats().GetSaturationLevel() <= 0.0F && updateCounter % (j4 * 3 + 1) == 0)
                        {
                            k11 += rand.Next(3) - 1;
                        }

                        if (flag2)
                        {
                            byte2 = 1;
                        }

                        int k13 = i6 - k10 * 8 - 9;
                        DrawTexturedModalRect(k13, k11, 16 + byte2 * 9, 27, 9, 9);

                        if (flag2)
                        {
                            if (k10 * 2 + 1 < l4)
                            {
                                DrawTexturedModalRect(k13, k11, j12 + 54, 27, 9, 9);
                            }

                            if (k10 * 2 + 1 == l4)
                            {
                                DrawTexturedModalRect(k13, k11, j12 + 63, 27, 9, 9);
                            }
                        }

                        if (k10 * 2 + 1 < j4)
                        {
                            DrawTexturedModalRect(k13, k11, j12 + 36, 27, 9, 9);
                        }

                        if (k10 * 2 + 1 == j4)
                        {
                            DrawTexturedModalRect(k13, k11, j12 + 45, 27, 9, 9);
                        }
                    }

                    if (mc.ThePlayer.IsInsideOfMaterial(Material.Water))
                    {
                        int l10 = mc.ThePlayer.GetAir();
                        int l11 = (int)Math.Ceiling(((double)(l10 - 2) * 10D) / 300D);
                        int k12 = (int)Math.Ceiling(((double)l10 * 10D) / 300D) - l11;

                        for (int i13 = 0; i13 < l11 + k12; i13++)
                        {
                            if (i13 < l11)
                            {
                                DrawTexturedModalRect(i6 - i13 * 8 - 9, k8, 16, 18, 9, 9);
                            }
                            else
                            {
                                DrawTexturedModalRect(i6 - i13 * 8 - 9, k8, 25, 18, 9, 9);
                            }
                        }
                    }
                }

                //GL.Disable(EnableCap.Blend);
                //GL.Enable(EnableCap.RescaleNormal);
                RenderHelper.EnableGUIStandardItemLighting();

                for (int k5 = 0; k5 < 9; k5++)
                {
                    int j6 = (i / 2 - 90) + k5 * 20 + 2;
                    int i7 = j - 16 - 3;
                    RenderInventorySlot(k5, j6, i7, par1);
                }

                RenderHelper.DisableStandardItemLighting();
                //GL.Disable(EnableCap.RescaleNormal);
            }

            if (mc.ThePlayer.GetSleepTimer() > 0)
            {
                //GL.Disable(EnableCap.DepthTest);
                //GL.Disable(EnableCap.AlphaTest);
                int   k  = mc.ThePlayer.GetSleepTimer();
                float f1 = (float)k / 100F;

                if (f1 > 1.0F)
                {
                    f1 = 1.0F - (float)(k - 100) / 10F;
                }

                int j1 = (int)(220F * f1) << 24 | 0x101020;
                DrawRect(0, 0, i, j, j1);
                //GL.Enable(EnableCap.AlphaTest);
                //GL.Enable(EnableCap.DepthTest);
            }

            if (mc.PlayerController.Func_35642_f() && mc.ThePlayer.ExperienceLevel > 0)
            {
                bool   flag1 = false;
                int    k1    = flag1 ? 0xffffff : 0x80ff20;
                String s     = (new StringBuilder()).Append("").Append(mc.ThePlayer.ExperienceLevel).ToString();
                int    i3    = (i - fontrenderer.GetStringWidth(s)) / 2;
                int    k3    = j - 31 - 4;
                fontrenderer.DrawString(s, i3 + 1, k3, 0);
                fontrenderer.DrawString(s, i3 - 1, k3, 0);
                fontrenderer.DrawString(s, i3, k3 + 1, 0);
                fontrenderer.DrawString(s, i3, k3 - 1, 0);
                fontrenderer.DrawString(s, i3, k3, k1);
            }

            if (mc.GameSettings.ShowDebugInfo)
            {
                //GL.PushMatrix();

                if (Minecraft.HasPaidCheckTime > 0L)
                {
                    //GL.Translate(0.0F, 32F, 0.0F);
                }

                fontrenderer.DrawStringWithShadow((new StringBuilder()).Append("Minecraft 1.2.5 (").Append(mc.Debug).Append(")").ToString(), 2, 2, 0xffffff);
                fontrenderer.DrawStringWithShadow(mc.DebugInfoRenders(), 2, 12, 0xffffff);
                fontrenderer.DrawStringWithShadow(mc.GetEntityDebug(), 2, 22, 0xffffff);
                fontrenderer.DrawStringWithShadow(mc.DebugInfoEntities(), 2, 32, 0xffffff);
                fontrenderer.DrawStringWithShadow(mc.GetWorldProviderName(), 2, 42, 0xffffff);
                //long l = Runtime.getRuntime().maxMemory();
                long l2 = GC.GetTotalMemory(false);
                //long l3 = Runtime.getRuntime().freeMemory();
                //long l5 = l2 - l3;
                //string s1 = (new StringBuilder()).Append("Used memory: ").Append((l5 * 100L) / l).Append("% (").Append(l5 / 1024L / 1024L).Append("MB) of ").Append(l / 1024L / 1024L).Append("MB").ToString();
                //DrawString(fontrenderer, s1, i - fontrenderer.GetStringWidth(s1) - 2, 2, 0xe0e0e0);
                //s1 = (new StringBuilder()).Append("Allocated memory: ").Append((l2 * 100L) / l).Append("% (").Append(l2 / 1024L / 1024L).Append("MB)").ToString();
                //DrawString(fontrenderer, s1, i - fontrenderer.GetStringWidth(s1) - 2, 12, 0xe0e0e0);
                DrawString(fontrenderer, (new StringBuilder()).Append("x: ").Append(mc.ThePlayer.PosX).ToString(), 2, 64, 0xe0e0e0);
                DrawString(fontrenderer, (new StringBuilder()).Append("y: ").Append(mc.ThePlayer.PosY).ToString(), 2, 72, 0xe0e0e0);
                DrawString(fontrenderer, (new StringBuilder()).Append("z: ").Append(mc.ThePlayer.PosZ).ToString(), 2, 80, 0xe0e0e0);
                DrawString(fontrenderer, (new StringBuilder()).Append("f: ").Append((int)Math.Floor((double)((mc.ThePlayer.RotationYaw * 4F) / 360F) + 0.5D) & 3).ToString(), 2, 88, 0xe0e0e0);
                int l7 = (int)Math.Floor(mc.ThePlayer.PosX);
                int l8 = (int)Math.Floor(mc.ThePlayer.PosY);
                int k9 = (int)Math.Floor(mc.ThePlayer.PosZ);

                if (mc.TheWorld != null && mc.TheWorld.BlockExists(l7, l8, k9))
                {
                    Chunk chunk = mc.TheWorld.GetChunkFromBlockCoords(l7, k9);
                    DrawString(fontrenderer, (new StringBuilder()).Append("lc: ").Append(chunk.GetTopFilledSegment() + 15).Append(" b: ").Append(chunk.Func_48490_a(l7 & 0xf, k9 & 0xf, mc.TheWorld.GetWorldChunkManager()).BiomeName).Append(" bl: ").Append(chunk.GetSavedLightValue(SkyBlock.Block, l7 & 0xf, l8, k9 & 0xf)).Append(" sl: ").Append(chunk.GetSavedLightValue(SkyBlock.Sky, l7 & 0xf, l8, k9 & 0xf)).Append(" rl: ").Append(chunk.GetBlockLightValue(l7 & 0xf, l8, k9 & 0xf, 0)).ToString(), 2, 96, 0xe0e0e0);
                }

                if (!mc.TheWorld.IsRemote)
                {
                    DrawString(fontrenderer, (new StringBuilder()).Append("Seed: ").Append(mc.TheWorld.GetSeed()).ToString(), 2, 112, 0xe0e0e0);
                }

                //GL.PopMatrix();
            }

            if (recordPlayingUpFor > 0)
            {
                float f2 = (float)recordPlayingUpFor - par1;
                int   l1 = (int)((f2 * 256F) / 20F);

                if (l1 > 255)
                {
                    l1 = 255;
                }

                if (l1 > 0)
                {
                    //GL.PushMatrix();
                    //GL.Translate(i / 2, j - 48, 0.0F);
                    //GL.Enable(EnableCap.Blend);
                    //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
                    int j2 = 0xffffff;

                    /*
                     * if (recordIsPlaying)
                     * {
                     *  j2 = Color.HSBtoRGB(f2 / 50F, 0.7F, 0.6F) & 0xffffff;
                     * }
                     */
                    fontrenderer.DrawString(recordPlaying, -(int)fontrenderer.GetStringWidth(recordPlaying) / 2, -4, j2 + (l1 << 24));
                    //GL.Disable(EnableCap.Blend);
                    //GL.PopMatrix();
                }
            }

            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            //GL.Disable(EnableCap.AlphaTest);
            //GL.PushMatrix();
            //GL.Translate(0.0F, j - 48, 0.0F);
            Func_50010_a(fontrenderer);
            //GL.PopMatrix();

            if ((mc.ThePlayer is EntityClientPlayerMP) && mc.GameSettings.KeyBindPlayerList.Pressed)
            {
                NetClientHandler     netclienthandler = ((EntityClientPlayerMP)mc.ThePlayer).SendQueue;
                List <GuiPlayerInfo> list             = netclienthandler.PlayerNames;
                int k2 = netclienthandler.CurrentServerMaxPlayers;
                int j3 = k2;
                int i4 = 1;

                for (; j3 > 20; j3 = ((k2 + i4) - 1) / i4)
                {
                    i4++;
                }

                int k4 = 300 / i4;

                if (k4 > 150)
                {
                    k4 = 150;
                }

                int  i5    = (i - i4 * k4) / 2;
                byte byte0 = 10;
                DrawRect(i5 - 1, byte0 - 1, i5 + k4 * i4, byte0 + 9 * j3, 0x8000000);

                for (int k6 = 0; k6 < k2; k6++)
                {
                    int j7 = i5 + (k6 % i4) * k4;
                    int i8 = byte0 + (k6 / i4) * 9;
                    DrawRect(j7, i8, (j7 + k4) - 1, i8 + 8, 0x20ffffff);
                    //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                    //GL.Enable(EnableCap.AlphaTest);

                    if (k6 >= list.Count)
                    {
                        continue;
                    }

                    GuiPlayerInfo guiplayerinfo = (GuiPlayerInfo)list[k6];
                    fontrenderer.DrawStringWithShadow(guiplayerinfo.Name, j7, i8, 0xffffff);
                    mc.RenderEngineOld.BindTexture(mc.RenderEngineOld.GetTexture("/gui/icons.png"));
                    int  l9    = 0;
                    byte byte1 = 0;

                    if (guiplayerinfo.ResponseTime < 0)
                    {
                        byte1 = 5;
                    }
                    else if (guiplayerinfo.ResponseTime < 150)
                    {
                        byte1 = 0;
                    }
                    else if (guiplayerinfo.ResponseTime < 300)
                    {
                        byte1 = 1;
                    }
                    else if (guiplayerinfo.ResponseTime < 600)
                    {
                        byte1 = 2;
                    }
                    else if (guiplayerinfo.ResponseTime < 1000)
                    {
                        byte1 = 3;
                    }
                    else
                    {
                        byte1 = 4;
                    }

                    ZLevel += 100F;
                    DrawTexturedModalRect((j7 + k4) - 12, i8, 0 + l9 * 10, 176 + byte1 * 8, 10, 8);
                    ZLevel -= 100F;
                }
            }

            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            //GL.Disable(EnableCap.Lighting);
            //GL.Enable(EnableCap.AlphaTest);
        }