PlayerAnvilUpdate
Link to playeranvilupdate
The PlayerAnvilUpdate Event is fired when a player places items in both the left and right slots of a anvil.
- If the event is canceled, vanilla behavior will not run, and the output will be set to null.
- If the event is not canceled, but the output is not null, it will set the output and not run vanilla behavior.
- if the output is null, and the event is not canceled, vanilla behavior will execute.
Event Class
Link to event-class
You will need to cast the event in the function header as this class:
crafttweaker.event.PlayerAnvilUpdateEvent
You can, of course, also import the class before and use that name then.
Event interface extensions
Link to event-interface-extensions
PlayerAnvilUpdate Events implement the following interfaces and are able to call all of their methods/getters/setters as well:
ZenGetters & ZenSetters
Link to zengetters--zensetters
The following information can be retrieved from the event:
ZenGetter | ZenSetter | type | Description |
---|---|---|---|
ZenGetter leftItem | ZenSetter | type IItemStack | Description The left side of the input. |
ZenGetter rightItem | ZenSetter | type IItemStack | Description The right side of the input. |
ZenGetter outputItem | ZenSetter outputItem | type IItemStack | Description Set this to set the output stack. |
ZenGetter itemName | ZenSetter | type string | Description The name to set the item, if the user specified one. |
ZenGetter xpCost | ZenSetter xpCost | type int | Description The base cost, set this to change it if output != null. |
ZenGetter materialCost | ZenSetter materialCost | type int | Description The number of items from the right slot to be consumed during the repair. Leave as 0 to consume the entire stack. |
ZenMethods
Link to zenmethods
event.cancel()
sets the event as cancelled.