-
Notifications
You must be signed in to change notification settings - Fork 0
Baubles Integration
TCreopargh edited this page Mar 18, 2021
·
5 revisions
ZenGetter: baublesInventory
Returns an IBaublesInventory
**Method: isBaubleEquipped(IItemStack bauble)
Returns an int, which is the slot number where the bauble is found. If the bauble is not found, returns -1.
Import:
import mods.ctintegration.baubles.IBaubleInventory;
Method | Description |
---|---|
boolean isItemValidForSlot(int slot, IItemStack item, IEntityLivingBase living) | |
boolean isItemValid(int slot, IItemStack item) | |
int getSlotCount() | Baubles adds 7 bauble slots, but some other mods (like Bring Me The Rings ) may add more slots, so always call this method if you are working with rings or trinkets. |
IItemStack getStackInSlot(int slot) |
This allows you to create a bauble item.
Requires ContentTweaker to be installed.
To get a BaubleItemRepresentation, call createBaubleItem(string unlocalizedName)
on VanillaFactory.
BaubleItemRepresentation extends ItemRepresentation, so all methods that are available to contenttweaker item builders are also available for it.
ZenProperty | Function representation | Description |
---|---|---|
String baubleType | - | must be one of 'AMULET', 'RING', 'BELT', 'TRINKET', 'HEAD', 'BODY', 'CHARM'. If not set it will be defaulted to TRINKET |
BaubleEventHandler.CanEquip canEquip | function(IItemStack bauble, IEntityLivingBase wearer) | Determines whether the bauble can be equipped |
BaubleEventHandler.CanUnequip canUnequip | function(IItemStack bauble, IEntityLivingBase wearer) | Determines whether the bauble can be unequipped |
BaubleEventHandler.OnWornTick onWornTick | function(IItemStack bauble, IEntityLivingBase wearer) | Called on every tick when wearing the bauble |
BaubleEventHandler.OnEquipped onEquipped | function(IItemStack bauble, IEntityLivingBase wearer) | Called when the bauble is equipped |
BaubleEventHandler.OnUnequipped onUnequipped | function(IItemStack bauble, IEntityLivingBase wearer) | Called when the bauble is unequipped |
BaubleEventHandler.WillAutoSync willAutoSync | function(IItemStack bauble, IEntityLivingBase wearer) | |
BaubleEventHandler.GetBaubleType getBaubleType | function(IItemStack bauble) | Note: this takes priority over the baubleType property, if this is set the baubleType will be ignored! |
Example
var baubleTest = VanillaFactory.createBaubleItem("test_bauble");
baubleTest.rarity = "rare";
baubleTest.onWornTick = function(bauble, wearer) {
if(wearer instanceof IPlayer) {
var player as IPlayer = wearer;
player.addExperience(1);
}
};
baubleTest.onUnequipped = function(bauble, wearer) {
if(wearer instanceof IPlayer) {
var player as IPlayer = wearer;
player.removeExperience(10);
}
};
baubleTest.onEquipped = function(bauble, wearer) {
if(wearer instanceof IPlayer) {
var player as IPlayer = wearer;
player.addExperience(10);
}
};
baubleTest.baubleType = "TRINKET";
baubleTest.register();