Upgrade fluid interfaces
9 tanks, with up to 64B/fluid with 2 capacity cards
This commit is contained in:
@@ -323,6 +323,10 @@ final class Registration {
|
|||||||
Upgrades.PATTERN_EXPANSION.registerItem(parts.iface(), 3);
|
Upgrades.PATTERN_EXPANSION.registerItem(parts.iface(), 3);
|
||||||
Upgrades.PATTERN_EXPANSION.registerItem(blocks.iface(), 3);
|
Upgrades.PATTERN_EXPANSION.registerItem(blocks.iface(), 3);
|
||||||
|
|
||||||
|
// Fluid Interface
|
||||||
|
Upgrades.CAPACITY.registerItem(parts.fluidIface(), 2);
|
||||||
|
Upgrades.CAPACITY.registerItem(blocks.fluidIface(), 2);
|
||||||
|
|
||||||
// IO Port!
|
// IO Port!
|
||||||
Upgrades.SPEED.registerItem(blocks.iOPort(), 3);
|
Upgrades.SPEED.registerItem(blocks.iOPort(), 3);
|
||||||
Upgrades.REDSTONE.registerItem(blocks.iOPort(), 1);
|
Upgrades.REDSTONE.registerItem(blocks.iOPort(), 1);
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ public class GuiFluidInterface extends GuiUpgradeable implements IConfigManagerH
|
|||||||
final IAEFluidTank fluidTank = this.host.getDualityFluidInterface().getTanks();
|
final IAEFluidTank fluidTank = this.host.getDualityFluidInterface().getTanks();
|
||||||
|
|
||||||
for (int i = 0; i < DualityFluidInterface.NUMBER_OF_TANKS; ++i) {
|
for (int i = 0; i < DualityFluidInterface.NUMBER_OF_TANKS; ++i) {
|
||||||
this.guiSlots.add(new GuiFluidTank(fluidTank, i, DualityFluidInterface.NUMBER_OF_TANKS + i, 35 + 18 * i, 53, 16, 68));
|
this.guiSlots.add(new GuiFluidTank(fluidTank, i, DualityFluidInterface.NUMBER_OF_TANKS + i, 8 + 18 * i, 53, 16, 68));
|
||||||
this.guiSlots.add(new GuiFluidSlot(configFluids, i, i, 35 + 18 * i, 35));
|
this.guiSlots.add(new GuiFluidSlot(configFluids, i, i, 8 + 18 * i, 35));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.priority = new GuiTabButton(this.getGuiLeft() + 154, this.getGuiTop(), 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender);
|
this.priority = new GuiTabButton(this.getGuiLeft() + 154, this.getGuiTop(), 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender);
|
||||||
@@ -78,8 +78,8 @@ public class GuiFluidInterface extends GuiUpgradeable implements IConfigManagerH
|
|||||||
@Override
|
@Override
|
||||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
this.fontRenderer.drawString(this.getGuiDisplayName(GuiText.FluidInterface.getLocal()), 8, 6, 4210752);
|
this.fontRenderer.drawString(this.getGuiDisplayName(GuiText.FluidInterface.getLocal()), 8, 6, 4210752);
|
||||||
this.fontRenderer.drawString(GuiText.Config.getLocal(), 35, 6 + 11 + 7, 4210752);
|
this.fontRenderer.drawString(GuiText.Config.getLocal(), 8, 6 + 11 + 7, 4210752);
|
||||||
this.fontRenderer.drawString(GuiText.StoredFluids.getLocal(), 35, 6 + 112 + 7, 4210752);
|
this.fontRenderer.drawString(GuiText.StoredFluids.getLocal(), 8, 6 + 112 + 7, 4210752);
|
||||||
this.fontRenderer.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
|
this.fontRenderer.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,9 +87,8 @@ public class GuiFluidTank extends GuiCustomSlot implements ITooltip {
|
|||||||
final IAEFluidStack fluid = this.tank.getFluidInSlot(this.slot);
|
final IAEFluidStack fluid = this.tank.getFluidInSlot(this.slot);
|
||||||
if (fluid != null && fluid.getStackSize() > 0) {
|
if (fluid != null && fluid.getStackSize() > 0) {
|
||||||
String desc = fluid.getFluid().getLocalizedName(fluid.getFluidStack());
|
String desc = fluid.getFluid().getLocalizedName(fluid.getFluidStack());
|
||||||
String amountToText = fluid.getStackSize() + "mB";
|
|
||||||
|
|
||||||
return desc + "\n" + amountToText;
|
return desc + "\n" + fluid.getStackSize() + "/" + this.tank.getTankProperties()[this.slot].getCapacity() + "mB";
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,14 +20,18 @@ package appeng.fluids.container;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
import appeng.api.config.Upgrades;
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketTargetFluidStack;
|
import appeng.core.sync.packets.PacketTargetFluidStack;
|
||||||
import appeng.fluids.helper.DualityFluidInterface;
|
import appeng.fluids.helper.DualityFluidInterface;
|
||||||
import appeng.fluids.helper.FluidSyncHelper;
|
import appeng.fluids.helper.FluidSyncHelper;
|
||||||
import appeng.fluids.helper.IFluidInterfaceHost;
|
import appeng.fluids.helper.IFluidInterfaceHost;
|
||||||
|
import appeng.fluids.util.AEFluidInventory;
|
||||||
import appeng.fluids.util.AEFluidStack;
|
import appeng.fluids.util.AEFluidStack;
|
||||||
|
import appeng.fluids.util.IAEFluidInventory;
|
||||||
import appeng.fluids.util.IAEFluidTank;
|
import appeng.fluids.util.IAEFluidTank;
|
||||||
import appeng.helpers.InventoryAction;
|
import appeng.helpers.InventoryAction;
|
||||||
import appeng.util.IConfigManagerHost;
|
import appeng.util.IConfigManagerHost;
|
||||||
@@ -35,10 +39,13 @@ import appeng.util.Platform;
|
|||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.IContainerListener;
|
import net.minecraft.inventory.IContainerListener;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
|
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -52,6 +59,9 @@ public class ContainerFluidInterface extends ContainerFluidConfigurable implemen
|
|||||||
// Holds the fluid the client wishes to extract, or null for insert
|
// Holds the fluid the client wishes to extract, or null for insert
|
||||||
private IAEFluidStack clientRequestedTargetFluid = null;
|
private IAEFluidStack clientRequestedTargetFluid = null;
|
||||||
|
|
||||||
|
@GuiSync(7)
|
||||||
|
public int capacityUpgrades = 0;
|
||||||
|
|
||||||
public ContainerFluidInterface(final InventoryPlayer ip, final IFluidInterfaceHost te) {
|
public ContainerFluidInterface(final InventoryPlayer ip, final IFluidInterfaceHost te) {
|
||||||
super(ip, te.getDualityFluidInterface().getHost());
|
super(ip, te.getDualityFluidInterface().getHost());
|
||||||
|
|
||||||
@@ -82,13 +92,26 @@ public class ContainerFluidInterface extends ContainerFluidConfigurable implemen
|
|||||||
|
|
||||||
if (Platform.isServer()) {
|
if (Platform.isServer()) {
|
||||||
this.tankSync.sendDiff(this.listeners);
|
this.tankSync.sendDiff(this.listeners);
|
||||||
|
if (capacityUpgrades != getUpgradeable().getInstalledUpgrades(Upgrades.CAPACITY)) {
|
||||||
|
capacityUpgrades = getUpgradeable().getInstalledUpgrades(Upgrades.CAPACITY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.detectAndSendChanges();
|
super.detectAndSendChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
||||||
|
super.onUpdate(field, oldValue, newValue);
|
||||||
|
if (Platform.isClient() && field.equals("capacityUpgrades")) {
|
||||||
|
this.capacityUpgrades = (int) newValue;
|
||||||
|
((AEFluidInventory) this.myDuality.getTanks()).setCapacity((int) (Math.pow(4, this.capacityUpgrades + 1) * Fluid.BUCKET_VOLUME));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setupConfig() {
|
protected void setupConfig() {
|
||||||
|
this.setupUpgrades();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -209,7 +232,7 @@ public class ContainerFluidInterface extends ContainerFluidConfigurable implemen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int availableUpgrades() {
|
public int availableUpgrades() {
|
||||||
return 0;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -59,10 +59,14 @@ import appeng.me.helpers.MachineSource;
|
|||||||
import appeng.me.storage.MEMonitorIFluidHandler;
|
import appeng.me.storage.MEMonitorIFluidHandler;
|
||||||
import appeng.me.storage.MEMonitorPassThrough;
|
import appeng.me.storage.MEMonitorPassThrough;
|
||||||
import appeng.me.storage.NullInventory;
|
import appeng.me.storage.NullInventory;
|
||||||
|
import appeng.parts.automation.StackUpgradeInventory;
|
||||||
|
import appeng.parts.automation.UpgradeInventory;
|
||||||
import appeng.util.ConfigManager;
|
import appeng.util.ConfigManager;
|
||||||
import appeng.util.IConfigManagerHost;
|
import appeng.util.IConfigManagerHost;
|
||||||
import appeng.util.InventoryAdaptor;
|
import appeng.util.InventoryAdaptor;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.inv.IAEAppEngInventory;
|
||||||
|
import appeng.util.inv.InvOperation;
|
||||||
import gregtech.api.block.machines.BlockMachine;
|
import gregtech.api.block.machines.BlockMachine;
|
||||||
import gregtech.api.metatileentity.MetaTileEntity;
|
import gregtech.api.metatileentity.MetaTileEntity;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@@ -88,11 +92,12 @@ import net.minecraftforge.items.IItemHandler;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
public class DualityFluidInterface implements IGridTickable, IStorageMonitorable, IAEFluidInventory, IUpgradeableHost, IConfigManagerHost, IConfigurableFluidInventory {
|
public class DualityFluidInterface implements IGridTickable, IStorageMonitorable, IAEFluidInventory, IAEAppEngInventory, IUpgradeableHost, IConfigManagerHost, IConfigurableFluidInventory {
|
||||||
public static final int NUMBER_OF_TANKS = 6;
|
public static final int NUMBER_OF_TANKS = 9;
|
||||||
public static final int TANK_CAPACITY = Fluid.BUCKET_VOLUME * 4;
|
public static final int TANK_CAPACITY = Fluid.BUCKET_VOLUME * 4;
|
||||||
private static final Collection<Block> BAD_BLOCKS = new HashSet<>(100);
|
private static final Collection<Block> BAD_BLOCKS = new HashSet<>(100);
|
||||||
private final ConfigManager cm = new ConfigManager(this);
|
private final ConfigManager cm = new ConfigManager(this);
|
||||||
@@ -100,6 +105,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
|||||||
private final IFluidInterfaceHost iHost;
|
private final IFluidInterfaceHost iHost;
|
||||||
private final IActionSource mySource;
|
private final IActionSource mySource;
|
||||||
private final IActionSource interfaceRequestSource;
|
private final IActionSource interfaceRequestSource;
|
||||||
|
private final UpgradeInventory upgrades;
|
||||||
private boolean hasConfig = false;
|
private boolean hasConfig = false;
|
||||||
private final IStorageMonitorableAccessor accessor = this::getMonitorable;
|
private final IStorageMonitorableAccessor accessor = this::getMonitorable;
|
||||||
private final AEFluidInventory tanks = new AEFluidInventory(this, NUMBER_OF_TANKS, TANK_CAPACITY);
|
private final AEFluidInventory tanks = new AEFluidInventory(this, NUMBER_OF_TANKS, TANK_CAPACITY);
|
||||||
@@ -117,6 +123,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
|||||||
this.gridProxy = networkProxy;
|
this.gridProxy = networkProxy;
|
||||||
this.gridProxy.setFlags(GridFlags.REQUIRE_CHANNEL);
|
this.gridProxy.setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||||
|
|
||||||
|
this.upgrades = new StackUpgradeInventory(this.gridProxy.getMachineRepresentation(), this, 2);
|
||||||
this.cm.registerSetting(Settings.INTERFACE_TERMINAL, YesNo.YES);
|
this.cm.registerSetting(Settings.INTERFACE_TERMINAL, YesNo.YES);
|
||||||
|
|
||||||
this.iHost = ih;
|
this.iHost = ih;
|
||||||
@@ -382,16 +389,17 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
|||||||
this.requireWork[slot] = work.setStackSize(-work.getStackSize());
|
this.requireWork[slot] = work.setStackSize(-work.getStackSize());
|
||||||
return;
|
return;
|
||||||
} else if (req != null) {
|
} else if (req != null) {
|
||||||
|
int tankSize = (int) (Math.pow(4, this.getInstalledUpgrades(Upgrades.CAPACITY) + 1) * Fluid.BUCKET_VOLUME);
|
||||||
if (stored == null || stored.getStackSize() == 0) // need to add stuff!
|
if (stored == null || stored.getStackSize() == 0) // need to add stuff!
|
||||||
{
|
{
|
||||||
this.requireWork[slot] = req.copy();
|
this.requireWork[slot] = req.copy();
|
||||||
this.requireWork[slot].setStackSize(TANK_CAPACITY);
|
this.requireWork[slot].setStackSize(tankSize);
|
||||||
return;
|
return;
|
||||||
} else if (req.equals(stored)) // same type ( qty different? )!
|
} else if (req.equals(stored)) // same type ( qty different? )!
|
||||||
{
|
{
|
||||||
if (stored.getStackSize() < TANK_CAPACITY) {
|
if (stored.getStackSize() != tankSize) {
|
||||||
this.requireWork[slot] = req.copy();
|
this.requireWork[slot] = req.copy();
|
||||||
this.requireWork[slot].setStackSize(TANK_CAPACITY - stored.getStackSize());
|
this.requireWork[slot].setStackSize(tankSize - stored.getStackSize());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@@ -512,12 +520,14 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
|||||||
data.setInteger("priority", this.priority);
|
data.setInteger("priority", this.priority);
|
||||||
this.tanks.writeToNBT(data, "storage");
|
this.tanks.writeToNBT(data, "storage");
|
||||||
this.config.writeToNBT(data, "config");
|
this.config.writeToNBT(data, "config");
|
||||||
|
this.upgrades.writeToNBT(data, "upgrades");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(final NBTTagCompound data) {
|
public void readFromNBT(final NBTTagCompound data) {
|
||||||
this.config.readFromNBT(data, "config");
|
this.config.readFromNBT(data, "config");
|
||||||
this.tanks.readFromNBT(data, "storage");
|
this.tanks.readFromNBT(data, "storage");
|
||||||
this.priority = data.getInteger("priority");
|
this.priority = data.getInteger("priority");
|
||||||
|
this.upgrades.readFromNBT(data, "upgrades");
|
||||||
this.readConfig();
|
this.readConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -589,6 +599,20 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
|||||||
this.iHost.saveChanges();
|
this.iHost.saveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeInventory(IItemHandler inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||||
|
if (inv == this.upgrades) {
|
||||||
|
this.tanks.setCapacity((int) (Math.pow(4, this.getInstalledUpgrades(Upgrades.CAPACITY) + 1) * Fluid.BUCKET_VOLUME));
|
||||||
|
try {
|
||||||
|
this.gridProxy.getTick().alertDevice(this.gridProxy.getNode());
|
||||||
|
} catch (GridAccessException ignored) {
|
||||||
|
}
|
||||||
|
for (int x = 0; x < NUMBER_OF_TANKS; x++) {
|
||||||
|
this.updatePlan(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IConfigManager getConfigManager() {
|
public IConfigManager getConfigManager() {
|
||||||
return this.cm;
|
return this.cm;
|
||||||
@@ -596,6 +620,9 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemHandler getInventoryByName(String name) {
|
public IItemHandler getInventoryByName(String name) {
|
||||||
|
if (name.equals("upgrades")) {
|
||||||
|
return this.upgrades;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,7 +636,18 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInstalledUpgrades(Upgrades u) {
|
public int getInstalledUpgrades(Upgrades u) {
|
||||||
return 0;
|
if (this.upgrades == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return this.upgrades.getInstalledUpgrades(u);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDrops(final List<ItemStack> drops) {
|
||||||
|
for (final ItemStack is : this.upgrades) {
|
||||||
|
if (!is.isEmpty()) {
|
||||||
|
drops.add(is);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ import net.minecraftforge.fluids.capability.IFluidHandler;
|
|||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class PartFluidInterface extends PartBasicState implements IGridTickable, IStorageMonitorable, IFluidInterfaceHost, IPriorityHost, IConfigurableFluidInventory {
|
public class PartFluidInterface extends PartBasicState implements IGridTickable, IStorageMonitorable, IFluidInterfaceHost, IPriorityHost, IConfigurableFluidInventory {
|
||||||
@@ -121,6 +122,11 @@ public class PartFluidInterface extends PartBasicState implements IGridTickable,
|
|||||||
this.duality.writeToNBT(data);
|
this.duality.writeToNBT(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getDrops(final List<ItemStack> drops, final boolean wrenched) {
|
||||||
|
this.duality.addDrops(drops);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getCableConnectionLength(AECableType cable) {
|
public float getCableConnectionLength(AECableType cable) {
|
||||||
return 4;
|
return 4;
|
||||||
|
|||||||
@@ -42,12 +42,15 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class TileFluidInterface extends AENetworkTile implements IGridTickable, IFluidInterfaceHost, IPriorityHost, IConfigurableFluidInventory {
|
public class TileFluidInterface extends AENetworkTile implements IGridTickable, IFluidInterfaceHost, IPriorityHost, IConfigurableFluidInventory {
|
||||||
@@ -83,6 +86,11 @@ public class TileFluidInterface extends AENetworkTile implements IGridTickable,
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getDrops(final World w, final BlockPos pos, final List<ItemStack> drops) {
|
||||||
|
this.duality.addDrops(drops);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void gridChanged() {
|
public void gridChanged() {
|
||||||
this.duality.gridChanged();
|
this.duality.gridChanged();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import java.util.Objects;
|
|||||||
public class AEFluidInventory implements IAEFluidTank {
|
public class AEFluidInventory implements IAEFluidTank {
|
||||||
private final IAEFluidStack[] fluids;
|
private final IAEFluidStack[] fluids;
|
||||||
private final IAEFluidInventory handler;
|
private final IAEFluidInventory handler;
|
||||||
private final int capacity;
|
private int capacity;
|
||||||
private IFluidTankProperties[] props = null;
|
private IFluidTankProperties[] props = null;
|
||||||
|
|
||||||
public AEFluidInventory(final IAEFluidInventory handler, final int slots, final int capcity) {
|
public AEFluidInventory(final IAEFluidInventory handler, final int slots, final int capcity) {
|
||||||
@@ -23,6 +23,10 @@ public class AEFluidInventory implements IAEFluidTank {
|
|||||||
this.capacity = capcity;
|
this.capacity = capcity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCapacity(int capacity) {
|
||||||
|
this.capacity = capacity;
|
||||||
|
}
|
||||||
|
|
||||||
public AEFluidInventory(final IAEFluidInventory handler, final int slots) {
|
public AEFluidInventory(final IAEFluidInventory handler, final int slots) {
|
||||||
this(handler, slots, Integer.MAX_VALUE);
|
this(handler, slots, Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
@@ -32,7 +36,7 @@ public class AEFluidInventory implements IAEFluidTank {
|
|||||||
if (slot >= 0 && slot < this.getSlots()) {
|
if (slot >= 0 && slot < this.getSlots()) {
|
||||||
if (Objects.equals(this.fluids[slot], fluid)) {
|
if (Objects.equals(this.fluids[slot], fluid)) {
|
||||||
if (fluid != null && fluid.getStackSize() != this.fluids[slot].getStackSize()) {
|
if (fluid != null && fluid.getStackSize() != this.fluids[slot].getStackSize()) {
|
||||||
this.fluids[slot].setStackSize(Math.min(fluid.getStackSize(), this.capacity));
|
this.fluids[slot].setStackSize(fluid.getStackSize());
|
||||||
this.onContentChanged(slot);
|
this.onContentChanged(slot);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -40,7 +44,7 @@ public class AEFluidInventory implements IAEFluidTank {
|
|||||||
this.fluids[slot] = null;
|
this.fluids[slot] = null;
|
||||||
} else {
|
} else {
|
||||||
this.fluids[slot] = fluid.copy();
|
this.fluids[slot] = fluid.copy();
|
||||||
this.fluids[slot].setStackSize(Math.min(fluid.getStackSize(), this.capacity));
|
this.fluids[slot].setStackSize(fluid.getStackSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onContentChanged(slot);
|
this.onContentChanged(slot);
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user