类 AnvilUpdateEvent
- 所有已实现的接口:
net.neoforged.bus.api.ICancellableEvent
It is fired after the vanilla result has been computed, and allows for modification (or overriding) of the result.
This event is fired on both the logical server and logical client.
-
嵌套类概要
嵌套类修饰符和类型类说明static final record
A record packing all the vanilla result data. -
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明getLeft()
返回 a copy of the item in the left input slot。int
Returns the material cost of the anvil operation, defaulting to the vanilla cost.@Nullable String
getName()
This is the name as sent by the client.Returns a mutable reference to the current output stack, defaulting to the vanilla output.getRight()
返回 a copy of the item in the right input slot。返回 a view of the vanilla result for the given anvil inputs。int
Returns the level cost of the anvil operation, defaulting to the vanilla cost.void
setCanceled
(boolean canceled) Cancels the event, preventing any further handling.void
setMaterialCost
(int materialCost) Sets the material cost (how many right inputs are consumed).void
Sets the output to the given item stack.void
setXpCost
(int xpCost) Sets the level cost of the anvil operation.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 net.neoforged.bus.api.ICancellableEvent
isCanceled
-
字段详细资料
-
left
-
right
-
name
-
vanillaResult
-
player
-
output
-
xpCost
private int xpCost -
materialCost
private int materialCost
-
-
构造器详细资料
-
AnvilUpdateEvent
-
-
方法详细资料
-
getLeft
返回 a copy of the item in the left input slot。- 返回:
- a copy of the item in the left input slot
-
getRight
返回 a copy of the item in the right input slot。- 返回:
- a copy of the item in the right input slot
-
getName
This is the name as sent by the client. It may be null if none has been sent. If empty, it indicates the user wishes to clear the custom name from the item.The server is unable to change the name field, as there is no S2C packet for it.
- 返回:
- The name that the output item should be set to, if applicable.
-
getVanillaResult
返回 a view of the vanilla result for the given anvil inputs。- 返回:
- a view of the vanilla result for the given anvil inputs
-
getOutput
Returns a mutable reference to the current output stack, defaulting to the vanilla output.If this event is cancelled, this output is ignored.
- 返回:
- The item that will be set in the output slot.
-
setOutput
Sets the output to the given item stack.- 参数:
output
- The stack to change the output to.
-
getXpCost
public int getXpCost()Returns the level cost of the anvil operation, defaulting to the vanilla cost.If this event is cancelled, the level cost is ignored.
- 返回:
- The level cost of the anvil operation.
-
setXpCost
public void setXpCost(int xpCost) Sets the level cost of the anvil operation.- 参数:
cost
- The new level cost.
-
getMaterialCost
public int getMaterialCost()Returns the material cost of the anvil operation, defaulting to the vanilla cost.The material cost is how many units of the right input stack are consumed.
- 返回:
- The material cost of the anvil operation.
-
setMaterialCost
public void setMaterialCost(int materialCost) Sets the material cost (how many right inputs are consumed).A material cost of zero consumes the entire stack (due to vanilla behavior).
A material cost higher than the count of the right stack consumes the entire stack.
The material cost being higher than the right item count does not prevent the output from being available.
- 参数:
materialCost
- The new material cost.
-
getPlayer
- 返回:
- The player using this anvil container.
-
setCanceled
public void setCanceled(boolean canceled) Cancels the event, preventing any further handling.When the event is cancelled, the outputs set by this event are ignored, and the anvil will produce no output.
- 指定者:
setCanceled
在接口中net.neoforged.bus.api.ICancellableEvent
-