mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 20:52:26 +00:00
Also fire cast-events for CastingBasin. Add separate events for CastingBasin and CastingTable.
This commit is contained in:
1 parent
3cab9c0063
commit
0821f9f77f
5 files changed
+45
-6
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package tconstruct.smeltery.logic;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import mantle.blocks.abstracts.InventoryLogic;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -10,6 +11,7 @@ import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidEvent;
|
||||
@@ -19,6 +21,8 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.crafting.CastingRecipe;
|
||||
import tconstruct.library.event.SmelteryCastEvent;
|
||||
import tconstruct.library.event.SmelteryCastedEvent;
|
||||
import tconstruct.library.util.IPattern;
|
||||
|
||||
public class CastingBasinLogic extends InventoryLogic implements IFluidTank, IFluidHandler, ISidedInventory
|
||||
@@ -120,6 +124,13 @@ public class CastingBasinLogic extends InventoryLogic implements IFluidTank, IFl
|
||||
CastingRecipe recipe = TConstruct.basinCasting.getCastingRecipe(resource, inventory[0]);
|
||||
if (recipe == null)
|
||||
return 0;
|
||||
|
||||
SmelteryCastEvent event = new SmelteryCastEvent.CastingBasin(recipe, resource);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
|
||||
if(event.getResult() == Event.Result.DENY)
|
||||
return 0;
|
||||
|
||||
this.capacity = updateCapacity(recipe.castingMetal.amount);
|
||||
|
||||
if (inventory[1] == null)
|
||||
@@ -328,8 +339,11 @@ public class CastingBasinLogic extends InventoryLogic implements IFluidTank, IFl
|
||||
CastingRecipe recipe = TConstruct.basinCasting.getCastingRecipe(liquid, inventory[0]);
|
||||
if (recipe != null)
|
||||
{
|
||||
inventory[1] = recipe.getResult();
|
||||
if (recipe.consumeCast)
|
||||
SmelteryCastedEvent event = new SmelteryCastedEvent.CastingBasin(recipe, recipe.getResult());
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
|
||||
inventory[1] = event.output;
|
||||
if (event.consumeCast)
|
||||
inventory[0] = null;
|
||||
liquid = null;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
|
||||
Reference in new issue
Block a user