mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 11:59:25 +00:00
* Added AT for ContainerRepair.stackSizeToBeUsedInRepair (Now public)
* Added ability to AnvilUpdateEvent to alter stackSizeToBeUsedInRepair (vanilla behavior is now reproducable) * Added AnvilRepairEvent, fired when the player removes an ItemStack from the output slot of ContainerRepair, and allows the chance to damage the anvil to be altered.
This commit is contained in:
1 parent
7cd820d855
commit
68fd0049fb
5 files changed
+62
-2
No files matched your search
@@ -48,6 +48,7 @@ import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent;
|
||||
import net.minecraftforge.event.entity.player.AnvilRepairEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.event.world.NoteBlockEvent;
|
||||
import static net.minecraft.init.Blocks.*;
|
||||
@@ -437,8 +438,16 @@ public class ForgeHooks
|
||||
|
||||
outputSlot.setInventorySlotContents(0, e.output);
|
||||
container.maximumCost = e.cost;
|
||||
container.stackSizeToBeUsedInRepair = e.materialCost;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static float onAnvilRepair(EntityPlayer player, ItemStack output, ItemStack left, ItemStack right)
|
||||
{
|
||||
AnvilRepairEvent e = new AnvilRepairEvent(player, left, right, output);
|
||||
MinecraftForge.EVENT_BUS.post(e);
|
||||
return e.breakChance;
|
||||
}
|
||||
|
||||
public static boolean onNoteChange(TileEntityNote te, byte old)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user