Наследование: TileEntity
Пример #1
0
 public ChestEditor(TileEntity e)
 {
     Chest = (Chest)e;
     InitializeComponent();
     for(byte i=0;i<54;i++)
     {
         InvControls[i] = new InventoryItemControl(i,ref Chest.Inventory);
         InvControls[i].Click += new EventHandler(inv_Click);
         InvControls[i].Changed += new InventoryItemControl.ChangedHandler(ChestEditor_Changed);
     }
     DoLayout();
     cmbType.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
     cmbType.DrawItem +=new DrawItemEventHandler(cmbType_DrawItem);
     cmbType.Items.Clear();
     cmbType.ValueMember = "ID";
     cmbType.DisplayMember = "Name";
     foreach (KeyValuePair<short, Block> k in Blocks.BlockList)
     {
         cmbType.Items.Add(k.Value);
     }
 }
Пример #2
0
 /// <summary>
 /// Load a TileEntity from an NbtCompound.
 /// </summary>
 /// <param name="CX">Chunk X Coordinate.</param>
 /// <param name="CY">Chunk Y Coordinate.</param>
 /// <param name="CS">Chunk horizontal scale (16 in /game/)</param>
 /// <param name="c"></param>
 /// <returns>TileEntity.</returns>
 public static TileEntity GetEntity(int CX, int CY, int CS, NbtCompound c)
 {
     TileEntity e;
     switch ((c["id"] as NbtString).Value)
     {
         case "Chest":
             e = new Chest(CX,CY,CS,c);
             break;
         case "MobSpawner":
             e = new MobSpawner(CX, CY, CS, c);
             break;
         case "Furnace":
             e = new Furnace(CX, CY, CS, c);
             break;
         case "Sign":
             e = new Sign(CX, CY, CS, c);
             break;
         case "NULL":
             // Ignore it :|
             return new TileEntity(CX, CY, CS, c);
         default:
     #if DEBUG
             Console.WriteLine("*** Unknown TileEntity: {0}", (c["id"] as NbtString).Value);
             Console.WriteLine(c);
     #endif
             File.WriteAllText(string.Format("UnknownTileEntity.{0}.txt", (c["id"] as NbtString).Value),c.ToString().Replace("\n","\r\n"));
             return new TileEntity(CX, CY, CS, c);
     }
     #if DEBUG
     Console.WriteLine("Loaded {1} @ {0}", e,e.Pos);
     #endif
     return e;
 }