-
Notifications
You must be signed in to change notification settings - Fork 0
Items
Tianyi Ma edited this page Jul 27, 2017
·
6 revisions
A unique object with attributes that represents an object that can interact with inventories, character equipment, and other ItemContainers.
// Registering an attribute preset
var HashMap = Java.type('java.util.HashMap');
var ItemFactory = Java.type('com.worldstone.worldengine.game.item.ItemFactory');
var presetMap = new HashMap();
presetMap.put('name', 'my_item');
presetMap.put('display_name', 'My Item');
ItemFactory.registerPreset('my_item_preset', presetMap);
// Getting an Item instance with an attribute preset
var ItemType = Java.type('com.worldstone.worldengine.game.item.ItemFactory.ItemType');
var myItemInstance = ItemFactory.getItem(ItemType.BORING, 'my_item_preset');