Remove sidedness on fluid interface, fixes #801
This commit is contained in:
@@ -4,10 +4,7 @@ import com.raoulvdberge.refinedstorage.RS;
|
|||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
import com.raoulvdberge.refinedstorage.RSUtils;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetworkNodeHolder;
|
import com.raoulvdberge.refinedstorage.api.network.INetworkNodeHolder;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBasic;
|
import com.raoulvdberge.refinedstorage.inventory.*;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
|
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerUpgrade;
|
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||||
@@ -55,6 +52,8 @@ public class NetworkNodeFluidInterface extends NetworkNode implements IComparabl
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private FluidHandlerFluidInterface tank = new FluidHandlerFluidInterface(tankIn, tankOut);
|
||||||
|
|
||||||
private ItemHandlerBasic in = new ItemHandlerBasic(1, new ItemHandlerListenerNetworkNode(this));
|
private ItemHandlerBasic in = new ItemHandlerBasic(1, new ItemHandlerListenerNetworkNode(this));
|
||||||
private ItemHandlerFluid out = new ItemHandlerFluid(1, new ItemHandlerListenerNetworkNode(this));
|
private ItemHandlerFluid out = new ItemHandlerFluid(1, new ItemHandlerListenerNetworkNode(this));
|
||||||
|
|
||||||
@@ -213,6 +212,10 @@ public class NetworkNodeFluidInterface extends NetworkNode implements IComparabl
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FluidHandlerFluidInterface getTank() {
|
||||||
|
return tank;
|
||||||
|
}
|
||||||
|
|
||||||
public FluidTank getTankIn() {
|
public FluidTank getTankIn() {
|
||||||
return tankIn;
|
return tankIn;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.inventory;
|
||||||
|
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fluids.FluidTank;
|
||||||
|
import net.minecraftforge.fluids.capability.FluidTankPropertiesWrapper;
|
||||||
|
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||||
|
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class FluidHandlerFluidInterface implements IFluidHandler {
|
||||||
|
private FluidTank input;
|
||||||
|
private FluidTank output;
|
||||||
|
private IFluidTankProperties[] properties;
|
||||||
|
|
||||||
|
public FluidHandlerFluidInterface(FluidTank input, FluidTank output) {
|
||||||
|
this.input = input;
|
||||||
|
this.output = output;
|
||||||
|
this.properties = new IFluidTankProperties[]{
|
||||||
|
new FluidTankPropertiesWrapper(input),
|
||||||
|
new FluidTankPropertiesWrapper(output)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IFluidTankProperties[] getTankProperties() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int fill(FluidStack resource, boolean doFill) {
|
||||||
|
return input.fill(resource, doFill);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public FluidStack drain(FluidStack resource, boolean doDrain) {
|
||||||
|
return output.drain(resource, doDrain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||||
|
return output.drain(maxDrain, doDrain);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,13 +13,13 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemHandlerGridFilterInGrid extends ItemHandlerBasic {
|
public class ItemHandlerGridFilterInGrid extends ItemHandlerBasic {
|
||||||
private List<GridFilter> filteredItems;
|
private List<GridFilter> filters;
|
||||||
private List<GridTab> tabs;
|
private List<GridTab> tabs;
|
||||||
|
|
||||||
public ItemHandlerGridFilterInGrid(List<GridFilter> filteredItems, List<GridTab> tabs) {
|
public ItemHandlerGridFilterInGrid(List<GridFilter> filters, List<GridTab> tabs) {
|
||||||
super(4, new ItemValidatorBasic(RSItems.GRID_FILTER));
|
super(4, new ItemValidatorBasic(RSItems.GRID_FILTER));
|
||||||
|
|
||||||
this.filteredItems = filteredItems;
|
this.filters = filters;
|
||||||
this.tabs = tabs;
|
this.tabs = tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ public class ItemHandlerGridFilterInGrid extends ItemHandlerBasic {
|
|||||||
protected void onContentsChanged(int slot) {
|
protected void onContentsChanged(int slot) {
|
||||||
super.onContentsChanged(slot);
|
super.onContentsChanged(slot);
|
||||||
|
|
||||||
filteredItems.clear();
|
filters.clear();
|
||||||
tabs.clear();
|
tabs.clear();
|
||||||
|
|
||||||
for (int i = 0; i < getSlots(); ++i) {
|
for (int i = 0; i < getSlots(); ++i) {
|
||||||
@@ -51,7 +51,7 @@ public class ItemHandlerGridFilterInGrid extends ItemHandlerBasic {
|
|||||||
ItemStack icon = ItemGridFilter.getIcon(filter);
|
ItemStack icon = ItemGridFilter.getIcon(filter);
|
||||||
|
|
||||||
if (icon.isEmpty()) {
|
if (icon.isEmpty()) {
|
||||||
filteredItems.addAll(filters);
|
this.filters.addAll(filters);
|
||||||
} else {
|
} else {
|
||||||
tabs.add(new GridTab(filters, ItemGridFilter.getName(filter), icon));
|
tabs.add(new GridTab(filters, ItemGridFilter.getName(filter), icon));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class TileFluidInterface extends TileNode<NetworkNodeFluidInterface> {
|
|||||||
@Override
|
@Override
|
||||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||||
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(facing == EnumFacing.DOWN ? getNode().getTankOut() : getNode().getTankIn());
|
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(getNode().getTank());
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getCapability(capability, facing);
|
return super.getCapability(capability, facing);
|
||||||
|
|||||||
Reference in New Issue
Block a user