public Block(SlotItem s) { if (s == null) { ID = BlockID.Air; return; } ID = s.ItemID.ToBlock(); Meta = s.Uses; Light = Block.LightLevel((byte)ID); }
public static SlotItem Read(EndianBinaryReader r) { SlotItem i = new SlotItem(); i.ItemID = (BlockID)r.ReadInt16(); if (i.ItemID < 0) return null; #if DEBUGPACKET if (((int)i.ItemID).ToString() == i.ItemID.ToString()) throw new NotImplementedException("BlockID: " + (int)i.ItemID); #endif i.Count = r.ReadByte(); i.Uses = r.ReadInt16(); //Metadata i.Data = Tag.ReadTag(r); //Debug.WriteLine(i + ": " + i.Data); return i; }
public static void Write(EndianBinaryWriter w, SlotItem i) { if (i == null || i.ItemID < 0) { w.Write((short)-1); return; } w.Write((short)i.ItemID); w.Write((byte)i.Count); w.Write((short)i.Uses); if (i.ItemID == BlockID.BareHands) return; if (i.Data == null) { w.Write((byte)0); return; } if (i.Data is TagEnd) w.Write((byte)0); else i.Data.Write(w); }
protected virtual bool ImportMeta(int id, SlotItem val) { return false; }
protected virtual bool ImportMeta(int id, SlotItem val) { return(false); }