Skip to content

Commit

Permalink
Fix anvil output slots being wrong by adding new ones. Closes #3121 w…
Browse files Browse the repository at this point in the history
…ithout breaking existing mod workarounds for the badly ordered slots.
  • Loading branch information
cpw committed Jul 29, 2016
1 parent 40f335b commit 7e15ab7
Showing 1 changed file with 43 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

/**
* Fired when the player removes a "repaired" item from the Anvil's Output slot.
*
* breakChance specifies as a percentage the chance that the anvil will be "damaged" when used.
*
* ItemStacks are the inputs/output from the anvil. They cannot be edited.
*/
public class AnvilRepairEvent extends PlayerEvent
{

Expand All @@ -30,7 +37,7 @@ public class AnvilRepairEvent extends PlayerEvent
private final ItemStack output; // Set this to set the output stack
private float breakChance; // Anvil's chance to break (reduced by 1 durability) when this is complete. Default is 12% (0.12f)

public AnvilRepairEvent(EntityPlayer player, ItemStack output, ItemStack left, ItemStack right)
public AnvilRepairEvent(EntityPlayer player, ItemStack left, ItemStack right, ItemStack output)
{
super(player);
this.output = output;
Expand All @@ -40,15 +47,42 @@ public AnvilRepairEvent(EntityPlayer player, ItemStack output, ItemStack left, I
}

/**
* Fired when the player removes a "repaired" item from the Anvil's Output slot.
*
* breakChance specifies as a percentage the chance that the anvil will be "damaged" when used.
*
* ItemStacks are the inputs/output from the anvil. They cannot be edited.
* Deprecated in favour of {@link #getItemInput()} - this is actually the output slot of the anvil
* @return the output slot
*/
@Deprecated
public ItemStack getLeft() { return output; }
/**
* Deprecated in favour of {@link #getIngredientInput()}} - this is actually the first input slot of the anvil
* @return the first input slot
*/
public ItemStack getLeft() { return left; }
public ItemStack getRight() { return right; }
public ItemStack getOutput() { return output; }
@Deprecated
public ItemStack getRight() { return left; }
/**
* Deprecated in favour of {@link #getItemResult()} - this is actually the second input slot of the anvil
* @return the second input slot
*/
@Deprecated
public ItemStack getOutput() { return right; }

/**
* Get the output result from the anvil
* @return the output
*/
public ItemStack getItemResult() { return output; }

/**
* Get the first item input into the anvil
* @return the first input slot
*/
public ItemStack getItemInput() { return left; }

/**
* Get the second item input into the anvil
* @return the second input slot
*/
public ItemStack getIngredientInput() { return right; }

public float getBreakChance() { return breakChance; }
public void setBreakChance(float breakChance) { this.breakChance = breakChance; }
}

0 comments on commit 7e15ab7

Please sign in to comment.