2014-04-02 18:33:13 -07:00
|
|
|
package net.minecraftforge.event;
|
|
|
|
|
|
2014-11-25 19:56:35 -08:00
|
|
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
|
|
|
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
2014-04-02 18:33:13 -07:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* AnvilUpdateEvent 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.
|
|
|
|
|
*/
|
|
|
|
|
@Cancelable
|
|
|
|
|
public class AnvilUpdateEvent extends Event
|
|
|
|
|
{
|
|
|
|
|
public final ItemStack left; // The left side of the input
|
|
|
|
|
public final ItemStack right; // The right side of the input
|
|
|
|
|
public final String name; // The name to set the item, if the user specified one.
|
|
|
|
|
public ItemStack output; // Set this to set the output stack
|
|
|
|
|
public int cost; // The base cost, set this to change it if output != null
|
2014-08-04 16:54:35 -04:00
|
|
|
public int materialCost; // The number of items from the right slot to be consumed during the repair. Leave as 0 to consume the entire stack.
|
2014-04-02 18:33:13 -07:00
|
|
|
|
|
|
|
|
public AnvilUpdateEvent(ItemStack left, ItemStack right, String name, int cost)
|
|
|
|
|
{
|
|
|
|
|
this.left = left;
|
|
|
|
|
this.right = right;
|
|
|
|
|
this.name = name;
|
|
|
|
|
this.cost = cost;
|
2014-08-04 16:54:35 -04:00
|
|
|
this.materialCost = 0;
|
2014-04-02 18:33:13 -07:00
|
|
|
}
|
|
|
|
|
}
|