예제 #1
0
        public static bool TryGetItem(short id, short meta, out Item item)
        {
            /*var minetItem = MiNET.Items.ItemFactory.GetItem(id, meta);
             * if (minetItem != null)
             * {
             *      if (TryGetItem($"minecraft:{minetItem.}"))
             * }*/

            var reverseResult = MiNET.Items.ItemFactory.NameToId.FirstOrDefault(x => x.Value == id);

            if (!string.IsNullOrWhiteSpace(reverseResult.Key))
            {
                if (TryGetItem($"minecraft:{reverseResult.Key}", out item))
                {
                    return(true);
                }
            }

            var entry = SecItemEntries.FirstOrDefault(x => x.Type == id);

            if (entry == null)
            {
                item = null;
                return(false);
            }

            if (TryGetItem($"minecraft:{entry.TextType}", out item))
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
        public static bool TryGetItem(short id, short meta, out Item item)
        {
            var entry = SecItemEntries.FirstOrDefault(x => x.Type == id);

            if (entry == null)
            {
                item = null;
                return(false);
            }

            if (TryGetItem($"minecraft:{entry.TextType}", out item))
            {
                return(true);
            }

            return(false);
        }