Open
Description
Parse Item JSON format and produce a Item object
Item JSON ===some parsing process===> Item Object
JSON format is defined in:
https://infinitystudio.github.io/SimpleAPI/docs/Item.html
Parsing process context: (the thing this module doesn't need to care about)
modid, the modid of the Mod that own this item
ItemTypeHandlerRegistry, the registry of the ItemTypeHandler, which is used to decorate Item with special property
CapabilityInjector, the api that injects the capability to a thing
ItemTypeHandlerRegistry和CapabilityInjector我都没写……没实现也没interface……LG你就定义2个顺手的interface把……modid和这俩你就当方法参数传进来就好了
Parsing process overview:
- determine the type of the item
- new DelegatedItem()
- set forge registry resLocation and unlocalized name (basically, you combine the modid and id property in JSON and generate resLocation and unlocalized name)
- inject capability if it requires
- get the ItemTypeHandler and feed the JSON (or maybe you store other property in a new map) to this handler. So the Item is decorated with special properties
sample interfaces:
interface ItemTypeHandler {
void decorate(ItemDelegate item, JsonOrMap data);
}
interface ItemTypeHandlerRegistry {
ItemTypeHandler getHandler(String type)
}
interface CapabilityInjector{
void inject(Object obj, CapabilityInfo info);
}
(当然如果那些没实现的你想实现也没问题23333)
Activity