mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
Fluid events now know how much fluid is moved
Added amount that is being filled/drained to the FluidEvent Added constructors without amount to ensure backwards compability Added deprecation to amountless constructors
This commit is contained in:
1 parent
83e7130216
commit
a3e8f0cbe4
2 files changed
+29
-3
No files matched your search
@@ -46,10 +46,23 @@ public class FluidEvent extends Event
|
||||
public static class FluidFillingEvent extends FluidEvent
|
||||
{
|
||||
public final IFluidTank tank;
|
||||
public final int amount;
|
||||
|
||||
/**
|
||||
* @deprecated Will be removed in 1.8
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public FluidFillingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank)
|
||||
{
|
||||
this(fluid, world, x, y, z, tank, -1);
|
||||
}
|
||||
|
||||
public FluidFillingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank, int amount)
|
||||
{
|
||||
super(fluid, world, x, y, z);
|
||||
this.tank = tank;
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,9 +76,22 @@ public class FluidEvent extends Event
|
||||
public static class FluidDrainingEvent extends FluidEvent
|
||||
{
|
||||
public final IFluidTank tank;
|
||||
public final int amount;
|
||||
|
||||
/**
|
||||
* @deprecated Will be removed in 1.8
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public FluidDrainingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank)
|
||||
{
|
||||
this(fluid, world, x, y, z, tank, -1);
|
||||
}
|
||||
|
||||
public FluidDrainingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank, int amount)
|
||||
{
|
||||
super(fluid, world, x, y, z);
|
||||
this.amount = amount;
|
||||
this.tank = tank;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class FluidTank implements IFluidTank
|
||||
|
||||
if (tile != null)
|
||||
{
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluid, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluid, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, fluid.amount));
|
||||
}
|
||||
return fluid.amount;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public class FluidTank implements IFluidTank
|
||||
|
||||
if (tile != null)
|
||||
{
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluid, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluid, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, filled));
|
||||
}
|
||||
return filled;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public class FluidTank implements IFluidTank
|
||||
|
||||
if (tile != null)
|
||||
{
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, drained));
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
|
||||
Reference in new issue
Block a user