From 7e15ab7da19e1e3d27edacb92f08d44dba8c2de6 Mon Sep 17 00:00:00 2001 From: cpw Date: Thu, 28 Jul 2016 22:17:35 -0400 Subject: [PATCH] Fix anvil output slots being wrong by adding new ones. Closes #3121 without breaking existing mod workarounds for the badly ordered slots. --- .../event/entity/player/AnvilRepairEvent.java | 52 +++++++++++++++---- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/minecraftforge/event/entity/player/AnvilRepairEvent.java b/src/main/java/net/minecraftforge/event/entity/player/AnvilRepairEvent.java index 0c81c1646..80d118c1d 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/AnvilRepairEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/AnvilRepairEvent.java @@ -22,6 +22,13 @@ package net.minecraftforge.event.entity.player; 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 { @@ -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; @@ -40,15 +47,42 @@ public class AnvilRepairEvent extends PlayerEvent } /** - * 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 */ - public ItemStack getLeft() { return left; } - public ItemStack getRight() { return right; } - public ItemStack getOutput() { return output; } + @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 + */ + @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; } }