This works, but i am just curious if i am misunderstanding something, or generally if something better exists
Validate(obj)
{
if(typeof(obj)==="string")
{
if(Item.exists(obj)){console.info("[OracularAPI] obj is an item!");return [Item.of(obj).toJson()]}
else if(Fluid.exists(obj)||Fluid.exists(obj.replace(/ \d+$/,""))){console.info("[OracularAPI] obj is a fluid!");return [Fluid.of(obj).toJson()]}
else
{
console.info("[OracularAPI] Failed to verify string!");
return this.Validate("minecraft:bedrock")
//also yet another way of me shitting on bedrock edition.
}
}
if(Array.isArray(obj)){console.info("[OracularAPI] obj is an array!");return obj.map(i=>this.Validate(i));}
console.info("[OracularAPI] obj is a passthrough object!");return obj;//pass-through: user may be trying to pass already raw objects, assumed to be valid, errors are not my problem anyways
//not my problem: the code this is supposed to replace has the same behaviour
},
also, what is the deal with
Item.isItem()