From dc000f4740ff898e3e644f1ca6c638a1a8739ed2 Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 10 Nov 2013 21:48:20 -0500 Subject: [PATCH] Implemented AutoCraft event Not that the armbot works right now but why not. We can just fix it later if it doesn't work. --- .../common/imprinter/TileEntityImprinter.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/dark/assembly/common/imprinter/TileEntityImprinter.java b/src/dark/assembly/common/imprinter/TileEntityImprinter.java index d764c5de0..c91060d89 100644 --- a/src/dark/assembly/common/imprinter/TileEntityImprinter.java +++ b/src/dark/assembly/common/imprinter/TileEntityImprinter.java @@ -27,6 +27,7 @@ import com.google.common.io.ByteArrayDataInput; import dark.api.al.coding.IArmbot; import dark.api.al.coding.IArmbotUseable; +import dark.api.events.AutoCraftEvent; import dark.core.common.DarkMain; import dark.core.helpers.AutoCraftingManager; import dark.core.helpers.AutoCraftingManager.IAutoCrafter; @@ -394,10 +395,14 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv if (this.imprinterMatrix[craftingOutputSlot] != null) { - armbot.grab(this.imprinterMatrix[craftingOutputSlot].copy()); - this.onPickUpFromSlot(null, 2, this.imprinterMatrix[craftingOutputSlot]); - this.imprinterMatrix[craftingOutputSlot] = null; - return true; + AutoCraftEvent.PreCraft event = new AutoCraftEvent.PreCraft(this.worldObj, new Vector3(this), this, this.imprinterMatrix[craftingOutputSlot]); + if (!event.isCanceled()) + { + armbot.grab(this.imprinterMatrix[craftingOutputSlot].copy()); + this.onPickUpFromSlot(null, 2, this.imprinterMatrix[craftingOutputSlot]); + this.imprinterMatrix[craftingOutputSlot] = null; + return true; + } } return false;