From 11fd75561926b81acea466e0965468c700e894c0 Mon Sep 17 00:00:00 2001 From: Modmuss50 Date: Thu, 10 Sep 2015 19:39:00 +0100 Subject: [PATCH] Fixed issues with the tank not syncing on the disel genertaor --- .../techreborn/tiles/TileDieselGenerator.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/techreborn/tiles/TileDieselGenerator.java b/src/main/java/techreborn/tiles/TileDieselGenerator.java index 5f511d3db..7665b4765 100644 --- a/src/main/java/techreborn/tiles/TileDieselGenerator.java +++ b/src/main/java/techreborn/tiles/TileDieselGenerator.java @@ -65,18 +65,26 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - return tank.fill(resource, doFill); + int filled = tank.fill(resource, doFill); + tank.compareAndUpdate(); + return filled; } @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, - boolean doDrain) { - return tank.drain(resource.amount, doDrain); + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + if (resource == null || !resource.isFluidEqual(tank.getFluid())) { + return null; + } + FluidStack fluidStack = tank.drain(resource.amount, doDrain); + tank.compareAndUpdate(); + return fluidStack; } @Override public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - return tank.drain(maxDrain, doDrain); + FluidStack drained = tank.drain(maxDrain, doDrain); + tank.compareAndUpdate(); + return drained; } @Override