public override void RightClick(int i, int j) { int ID = mod.GetID <TEQEChest>(i, j); if (ID == -1) { return; } TEQEChest qeChest = (TEQEChest)TileEntity.ByID[ID]; Point16 topLeft = TheOneLibrary.Utility.Utility.TileEntityTopLeft(i, j); int realTileX = topLeft.X * 16; int realTileY = topLeft.Y * 16; Rectangle left = new Rectangle(realTileX + 2, realTileY + 4, 6, 10); Rectangle middle = new Rectangle(realTileX + 12, realTileY + 4, 8, 10); Rectangle right = new Rectangle(realTileX + 24, realTileY + 4, 6, 10); if (Main.LocalPlayer.HeldItem.type != mod.ItemType <QEBag>()) { Frequency frequency = qeChest.frequency; bool handleFrequency = false; if (left.Contains(Main.MouseWorld) && qeChest.animState == 0) { frequency.colorLeft = Utility.ColorFromItem(frequency.colorLeft); handleFrequency = true; } else if (middle.Contains(Main.MouseWorld) && qeChest.animState == 0) { frequency.colorMiddle = Utility.ColorFromItem(frequency.colorMiddle); handleFrequency = true; } else if (right.Contains(Main.MouseWorld) && qeChest.animState == 0) { frequency.colorRight = Utility.ColorFromItem(frequency.colorRight); handleFrequency = true; } else { qeChest.opened = !qeChest.opened; PortableStorage.Instance.HandleUI <QEChestUI>(ID); Main.PlaySound(SoundID.DD2_EtherianPortalOpen.WithVolume(0.5f)); } if (handleFrequency) { qeChest.frequency = frequency; } qeChest.SendUpdate(); } else { Main.LocalPlayer.noThrow = 2; QEBag bag = (QEBag)Main.LocalPlayer.HeldItem.modItem; bag.frequency = qeChest.frequency; NetUtility.SyncItem(bag.item); } }
public void Load(QEBag bag) { guid = bag.guid; for (int i = 0; i < PortableStorage.Instance.GetModWorld <PSWorld>().enderItems[bag.frequency].Count; i++) { UIContainerSlot slot = new UIContainerSlot(bag, i); gridItems.Add(slot); } }
public void Load(QEBag bag) { this.bag = bag; for (int i = 0; i < PortableStorage.Instance.GetModWorld <PSWorld>().GetItemStorage(bag.frequency).Count; i++) { UIContainerSlot slot = new UIContainerSlot(bag, i); slot.OnInteract += Net.SyncQE; gridItems.Add(slot); } }