mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-17 10:55:06 +00:00
io bus
This commit is contained in:
1 parent
7a841a1eca
commit
e2947e41c9
9 files changed
+131
-797
No files matched your search
@@ -1,72 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidIO;
|
||||
import com.glodblock.github.common.parts.PartFluidExportBus;
|
||||
import com.glodblock.github.common.parts.PartFluidImportBus;
|
||||
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiFluidIO extends GuiUpgradeable {
|
||||
|
||||
private final FCSharedFluidBus bus;
|
||||
|
||||
public GuiFluidIO(InventoryPlayer inventoryPlayer, FCSharedFluidBus te) {
|
||||
super(new ContainerFluidIO(inventoryPlayer, te));
|
||||
this.bus = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiText getName() {
|
||||
return this.bus instanceof PartFluidImportBus ? GuiText.ImportBus : GuiText.ExportBus;
|
||||
}
|
||||
|
||||
public void update(int id, IAEFluidStack stack) {
|
||||
((ContainerFluidIO) this.cvb).getBus().setFluidInSlot(id, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(
|
||||
this.getGuiDisplayName(
|
||||
I18n.format(
|
||||
this.bus instanceof PartFluidImportBus ? NameConst.GUI_FLUID_IMPORT
|
||||
: NameConst.GUI_FLUID_EXPORT)),
|
||||
8,
|
||||
6,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
|
||||
|
||||
if (this.redstoneMode != null) {
|
||||
this.redstoneMode.set(this.cvb.getRedStoneMode());
|
||||
}
|
||||
|
||||
if (this.fuzzyMode != null) {
|
||||
this.fuzzyMode.set(this.cvb.getFuzzyMode());
|
||||
}
|
||||
|
||||
if (this.craftMode != null) {
|
||||
this.craftMode.set(this.cvb.getCraftingMode());
|
||||
}
|
||||
|
||||
if (this.schedulingMode != null) {
|
||||
this.schedulingMode.set(this.cvb.getSchedulingMode());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleButtonVisibility() {
|
||||
super.handleButtonVisibility();
|
||||
if (this.schedulingMode != null) {
|
||||
this.schedulingMode.setVisibility(
|
||||
this.bc.getInstalledUpgrades(Upgrades.CAPACITY) > 0 && this.bc instanceof PartFluidExportBus);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
|
||||
import com.glodblock.github.common.parts.PartFluidExportBus;
|
||||
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.FluidPrimaryGui;
|
||||
|
||||
import appeng.api.config.SchedulingMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.PrimaryGui;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
|
||||
public class ContainerFluidIO extends FCContainerFluidConfigurable {
|
||||
|
||||
private final FCSharedFluidBus bus;
|
||||
|
||||
public ContainerFluidIO(InventoryPlayer ip, FCSharedFluidBus te) {
|
||||
super(ip, te);
|
||||
this.bus = te;
|
||||
}
|
||||
|
||||
public FCSharedFluidBus getBus() {
|
||||
return this.bus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppEngInternalAEInventory getFakeFluidInv() {
|
||||
return (AppEngInternalAEInventory) this.bus.getInventoryByName("config");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettingsFromHost(IConfigManager cm) {
|
||||
super.loadSettingsFromHost(cm);
|
||||
if (this.getUpgradeable() instanceof PartFluidExportBus) {
|
||||
this.setCraftingMode((YesNo) cm.getSetting(Settings.CRAFT_ONLY));
|
||||
this.setSchedulingMode((SchedulingMode) cm.getSetting(Settings.SCHEDULING_MODE));
|
||||
}
|
||||
}
|
||||
|
||||
public void setSchedulingMode(final SchedulingMode schedulingMode) {
|
||||
this.schedulingMode = schedulingMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimaryGui getPrimaryGui() {
|
||||
|
||||
ContainerOpenContext context = getOpenContext();
|
||||
return new FluidPrimaryGui(
|
||||
GuiType.FLUID_BUS_IO,
|
||||
getTarget() instanceof PartFluidExportBus ? ItemAndBlockHolder.FLUID_EXPORT_BUS.stack()
|
||||
: ItemAndBlockHolder.FLUID_IMPORT_BUS.stack(),
|
||||
context.getTile(),
|
||||
context.getSide());
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
|
||||
public abstract class ItemBaseInfinityStorageCell extends FCBaseItemCell {
|
||||
|
||||
public ItemBaseInfinityStorageCell(Optional subName) {
|
||||
super(subName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getBytesLong(final ItemStack cellItem) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytesPerType(ItemStack cellItem) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getIdleDrain(ItemStack is) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes(ItemStack cellItem) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory(ItemStack is) {
|
||||
return new CellUpgrades(is, 0);
|
||||
}
|
||||
}
|
||||
@@ -1,309 +1,61 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import static appeng.util.Platform.convertStack;
|
||||
import static appeng.util.Platform.stackConvert;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.InsertionMode;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.SchedulingMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.crafting.ICraftingRequester;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.core.AELog;
|
||||
import appeng.helpers.MultiCraftingTracker;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.automation.PartBaseExportBus;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PartFluidExportBus extends FCSharedFluidBus implements ICraftingRequester {
|
||||
|
||||
private final BaseActionSource source;
|
||||
private final MultiCraftingTracker craftingTracker = new MultiCraftingTracker(this, 9);
|
||||
private int nextSlot = 0;
|
||||
private long fluidToSend = 1000;
|
||||
private boolean didSomething;
|
||||
public class PartFluidExportBus extends PartBaseExportBus<IAEFluidStack> {
|
||||
|
||||
public PartFluidExportBus(ItemStack is) {
|
||||
super(is);
|
||||
this.getConfigManager().registerSetting(Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE);
|
||||
this.getConfigManager().registerSetting(Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL);
|
||||
this.getConfigManager().registerSetting(Settings.CRAFT_ONLY, YesNo.NO);
|
||||
this.getConfigManager().registerSetting(Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT);
|
||||
this.source = new MachineSource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getFaceIcon() {
|
||||
return FCPartsTexture.PartFluidExportBus.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
return new TickingRequest(5, 40, this.isSleeping(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall) {
|
||||
return this.canDoBusWork() ? this.doBusWork() : TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDoBusWork() {
|
||||
return this.getProxy().isActive();
|
||||
}
|
||||
|
||||
private int getStartingSlot(final SchedulingMode schedulingMode, final int x) {
|
||||
if (schedulingMode == SchedulingMode.RANDOM) {
|
||||
return Platform.getRandom().nextInt(this.availableSlots());
|
||||
public int calculateAmountToSend() {
|
||||
double amount = 1000D;
|
||||
switch (this.getInstalledUpgrades(Upgrades.SPEED)) {
|
||||
case 4:
|
||||
amount = amount * 1.5;
|
||||
case 3:
|
||||
amount = amount * 2;
|
||||
case 2:
|
||||
amount = amount * 4;
|
||||
case 1:
|
||||
amount = amount * 8;
|
||||
}
|
||||
|
||||
if (schedulingMode == SchedulingMode.ROUNDROBIN) {
|
||||
return (this.nextSlot + x) % this.availableSlots();
|
||||
switch (this.getInstalledUpgrades(Upgrades.SUPERSPEED)) {
|
||||
case 4:
|
||||
amount = amount * 8;
|
||||
case 3:
|
||||
amount = amount * 12;
|
||||
case 2:
|
||||
amount = amount * 16;
|
||||
case 1:
|
||||
amount = amount * 32;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
private int availableSlots() {
|
||||
return Math.min(1 + this.getInstalledUpgrades(Upgrades.CAPACITY) * 4, this.getInv().getSizeInventory());
|
||||
}
|
||||
|
||||
private IInventory getInv() {
|
||||
return this.getInventoryByName("config");
|
||||
return (int) Math.floor(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TickRateModulation doBusWork() {
|
||||
if (!this.canDoBusWork()) {
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
this.didSomething = false;
|
||||
this.fluidToSend = this.calculateAmountToSend();
|
||||
final TileEntity te = this.getConnectedTE();
|
||||
InventoryAdaptor destination;
|
||||
if (te instanceof IFluidHandler && (destination = this.getHandler(te)) != null) {
|
||||
try {
|
||||
final ICraftingGrid cg = this.getProxy().getCrafting();
|
||||
final IFluidHandler fh = (IFluidHandler) te;
|
||||
final IMEMonitor<IAEFluidStack> inv = this.getProxy().getStorage().getFluidInventory();
|
||||
int i;
|
||||
for (i = 0; i < this.availableSlots() && this.fluidToSend > 0; i++) {
|
||||
final int slotToExport = this.getStartingSlot(this.getSchedulingMode(), i);
|
||||
IAEFluidStack fluid = AEFluidStack
|
||||
.create(ItemFluidPacket.getFluidStack(getInv().getStackInSlot(slotToExport)));
|
||||
if (fluid != null) {
|
||||
fluid.setStackSize(this.calculateAmountToSend());
|
||||
if (this.craftOnly()) {
|
||||
this.didSomething = this.craftingTracker.handleCrafting(
|
||||
i,
|
||||
fluid.getStackSize(),
|
||||
ItemFluidDrop.newAeStack(fluid),
|
||||
destination,
|
||||
this.getTile().getWorldObj(),
|
||||
this.getProxy().getGrid(),
|
||||
cg,
|
||||
this.source);
|
||||
continue;
|
||||
}
|
||||
// Find out how much to push
|
||||
final IAEFluidStack toPush = fluid.copy();
|
||||
final int amtToInsert = fh.fill(this.getSide().getOpposite(), toPush.getFluidStack(), false);
|
||||
toPush.setStackSize(amtToInsert);
|
||||
// Extract from the ME system. This might not be the same amount we actually send...
|
||||
final IAEFluidStack real = inv.extractItems(toPush, Actionable.MODULATE, this.source);
|
||||
if (real != null) {
|
||||
int realInserted = fh.fill(this.getSide().getOpposite(), real.getFluidStack(), true);
|
||||
if (realInserted < real.getStackSize()) {
|
||||
// Could not use the entirety of the amount we extracted, so put it back.
|
||||
// This can result in voiding fluids if there's nowhere for the fluids to go.
|
||||
fluid.setStackSize(real.getStackSize() - realInserted);
|
||||
inv.injectItems(fluid, Actionable.MODULATE, this.source);
|
||||
}
|
||||
this.fluidToSend -= realInserted;
|
||||
didSomething = true;
|
||||
} else if (this.isCraftingEnabled()) {
|
||||
// If we didn't send anything, try crafting it if we can.
|
||||
this.didSomething = this.craftingTracker.handleCrafting(
|
||||
i,
|
||||
fluid.getStackSize(),
|
||||
ItemFluidDrop.newAeStack(fluid),
|
||||
destination,
|
||||
this.getTile().getWorldObj(),
|
||||
this.getProxy().getGrid(),
|
||||
cg,
|
||||
this.source);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updateSchedulingMode(this.getSchedulingMode(), i);
|
||||
return didSomething ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
} catch (GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
return TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
private void updateSchedulingMode(final SchedulingMode schedulingMode, final int x) {
|
||||
if (schedulingMode == SchedulingMode.ROUNDROBIN) {
|
||||
this.nextSlot = (this.nextSlot + x) % this.availableSlots();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes(final IPartCollisionHelper bch) {
|
||||
bch.addBox(4, 4, 12, 12, 12, 14);
|
||||
bch.addBox(5, 5, 14, 11, 11, 15);
|
||||
bch.addBox(6, 6, 15, 10, 10, 16);
|
||||
bch.addBox(6, 6, 11, 10, 10, 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderInventory(final IPartRenderHelper rh, final RenderBlocks renderer) {
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartExportSides.getIcon(),
|
||||
CableBusTextures.PartExportSides.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
this.getFaceIcon(),
|
||||
CableBusTextures.PartExportSides.getIcon(),
|
||||
CableBusTextures.PartExportSides.getIcon());
|
||||
|
||||
rh.setBounds(4, 4, 12, 12, 12, 14);
|
||||
rh.renderInventoryBox(renderer);
|
||||
|
||||
rh.setBounds(5, 5, 14, 11, 11, 15);
|
||||
rh.renderInventoryBox(renderer);
|
||||
|
||||
rh.setBounds(6, 6, 15, 10, 10, 16);
|
||||
rh.renderInventoryBox(renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderStatic(final int x, final int y, final int z, final IPartRenderHelper rh,
|
||||
final RenderBlocks renderer) {
|
||||
this.setRenderCache(rh.useSimplifiedRendering(x, y, z, this, this.getRenderCache()));
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartExportSides.getIcon(),
|
||||
CableBusTextures.PartExportSides.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
this.getFaceIcon(),
|
||||
CableBusTextures.PartExportSides.getIcon(),
|
||||
CableBusTextures.PartExportSides.getIcon());
|
||||
|
||||
rh.setBounds(4, 4, 12, 12, 12, 14);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
rh.setBounds(5, 5, 14, 11, 11, 15);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
rh.setBounds(6, 6, 15, 10, 10, 16);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
this.getFaceIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon());
|
||||
|
||||
rh.setBounds(6, 6, 11, 10, 10, 12);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
this.renderLights(x, y, z, rh, renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneMode getRSMode() {
|
||||
return (RedstoneMode) this.getConfigManager().getSetting(Settings.REDSTONE_CONTROLLED);
|
||||
}
|
||||
|
||||
public SchedulingMode getSchedulingMode() {
|
||||
return (SchedulingMode) this.getConfigManager().getSetting(Settings.SCHEDULING_MODE);
|
||||
}
|
||||
|
||||
private boolean craftOnly() {
|
||||
return this.getConfigManager().getSetting(Settings.CRAFT_ONLY) == YesNo.YES;
|
||||
}
|
||||
|
||||
private boolean isCraftingEnabled() {
|
||||
return this.getInstalledUpgrades(Upgrades.CRAFTING) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs() {
|
||||
return this.craftingTracker.getRequestedJobs();
|
||||
}
|
||||
|
||||
protected InventoryAdaptor getHandler(TileEntity target) {
|
||||
return target != null ? InventoryAdaptor.getAdaptor(target, getSide().getOpposite()) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode) {
|
||||
final InventoryAdaptor d = this.getHandler(getConnectedTE());
|
||||
|
||||
protected IMEMonitor<IAEFluidStack> getMonitor() {
|
||||
try {
|
||||
if (d != null && this.getProxy().isActive()) {
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
final double power = Math.ceil(items.getStackSize() / 1000D);
|
||||
|
||||
if (energy.extractAEPower(power, mode, PowerMultiplier.CONFIG) > power - 0.01) {
|
||||
IAEItemStack remaining;
|
||||
|
||||
if (mode == Actionable.SIMULATE) {
|
||||
remaining = stackConvert(d.simulateAddStack(convertStack(items), InsertionMode.DEFAULT));
|
||||
} else {
|
||||
remaining = stackConvert(d.addStack(convertStack(items), InsertionMode.DEFAULT));
|
||||
}
|
||||
|
||||
return remaining;
|
||||
}
|
||||
}
|
||||
return this.getProxy().getStorage().getFluidInventory();
|
||||
} catch (final GridAccessException e) {
|
||||
AELog.debug(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange(ICraftingLink link) {
|
||||
this.craftingTracker.jobStateChange(link);
|
||||
}
|
||||
protected void doFuzzy(IAEFluidStack aes, FuzzyMode fzMode, InventoryAdaptor destination, IEnergyGrid energy,
|
||||
IMEMonitor<IAEFluidStack> gridInv) {}
|
||||
|
||||
@Override
|
||||
protected void doOreDict(InventoryAdaptor destination, IEnergyGrid energy, IMEMonitor<IAEFluidStack> gridInv) {}
|
||||
}
|
||||
@@ -1,129 +1,136 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.SchedulingMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.client.StorageName;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.automation.PartBaseImportBus;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PartFluidImportBus extends FCSharedFluidBus {
|
||||
|
||||
private final BaseActionSource source;
|
||||
public class PartFluidImportBus extends PartBaseImportBus<IAEFluidStack> {
|
||||
|
||||
public PartFluidImportBus(ItemStack is) {
|
||||
super(is);
|
||||
this.getConfigManager().registerSetting(Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE);
|
||||
this.getConfigManager().registerSetting(Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL);
|
||||
this.getConfigManager().registerSetting(Settings.CRAFT_ONLY, YesNo.NO);
|
||||
this.getConfigManager().registerSetting(Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT);
|
||||
this.source = new MachineSource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getFaceIcon() {
|
||||
return FCPartsTexture.PartFluidImportBus.getIcon();
|
||||
protected Object getTarget() {
|
||||
TileEntity self = this.getHost().getTile();
|
||||
return this.getTileEntity(self, (new BlockPos(self)).getOffSet(this.getSide()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
return new TickingRequest(5, 40, this.isSleeping(), false);
|
||||
}
|
||||
private TileEntity getTileEntity(final TileEntity self, final BlockPos pos) {
|
||||
final World w = self.getWorldObj();
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall) {
|
||||
return this.canDoBusWork() ? this.doBusWork() : TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TickRateModulation doBusWork() {
|
||||
if (!this.canDoBusWork()) {
|
||||
return TickRateModulation.IDLE;
|
||||
if (w.getChunkProvider().chunkExists(pos.getX() >> 4, pos.getZ() >> 4)) {
|
||||
return w.getTileEntity(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
final TileEntity te = this.getConnectedTE();
|
||||
return null;
|
||||
}
|
||||
|
||||
if (te instanceof IFluidHandler) {
|
||||
try {
|
||||
final IFluidHandler fh = (IFluidHandler) te;
|
||||
FluidTankInfo[] tanksInfo = fh.getTankInfo(this.getSide().getOpposite());
|
||||
if (tanksInfo == null) {
|
||||
return TickRateModulation.SLOWER;
|
||||
@Override
|
||||
public int calculateAmountToSend() {
|
||||
double amount = 1000D;
|
||||
switch (this.getInstalledUpgrades(Upgrades.SPEED)) {
|
||||
case 4:
|
||||
amount = amount * 1.5;
|
||||
case 3:
|
||||
amount = amount * 2;
|
||||
case 2:
|
||||
amount = amount * 4;
|
||||
case 1:
|
||||
amount = amount * 8;
|
||||
}
|
||||
switch (this.getInstalledUpgrades(Upgrades.SUPERSPEED)) {
|
||||
case 4:
|
||||
amount = amount * 8;
|
||||
case 3:
|
||||
amount = amount * 12;
|
||||
case 2:
|
||||
amount = amount * 16;
|
||||
case 1:
|
||||
amount = amount * 32;
|
||||
}
|
||||
return (int) Math.floor(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IMEMonitor<IAEFluidStack> getMonitor() {
|
||||
try {
|
||||
return this.getProxy().getStorage().getFluidInventory();
|
||||
} catch (final GridAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean importStuff(final Object myTarget, final IAEFluidStack whatToImport,
|
||||
final IMEMonitor<IAEFluidStack> inv, final IEnergySource energy, final FuzzyMode fzMode) {
|
||||
if (myTarget instanceof IFluidHandler fh) {
|
||||
FluidTankInfo[] tanksInfo = fh.getTankInfo(this.getSide().getOpposite());
|
||||
if (tanksInfo == null) return false;
|
||||
|
||||
int maxDrain = this.calculateAmountToSend();
|
||||
boolean drained = false;
|
||||
|
||||
for (FluidTankInfo tankInfo : tanksInfo) {
|
||||
if (tankInfo.fluid == null) continue;
|
||||
|
||||
FluidStack fluidStack = new FluidStack(tankInfo.fluid, Math.min(tankInfo.fluid.amount, maxDrain));
|
||||
fluidStack = fh.drain(this.getSide().getOpposite(), fluidStack, false);
|
||||
if (this.filterEnabled() && !this.isInFilter(fluidStack)) continue;
|
||||
|
||||
final AEFluidStack aeFluidStack = AEFluidStack.create(fluidStack);
|
||||
if (aeFluidStack != null) {
|
||||
final IAEFluidStack notInserted = inv.injectItems(aeFluidStack, Actionable.MODULATE, this.mySrc);
|
||||
|
||||
if (notInserted != null && notInserted.getStackSize() > 0) {
|
||||
aeFluidStack.decStackSize(notInserted.getStackSize());
|
||||
}
|
||||
|
||||
fh.drain(this.getSide().getOpposite(), aeFluidStack.getFluidStack(), true);
|
||||
maxDrain -= aeFluidStack.getFluidStack().amount;
|
||||
drained = true;
|
||||
}
|
||||
|
||||
final IMEMonitor<IAEFluidStack> inv = this.getProxy().getStorage().getFluidInventory();
|
||||
int maxDrain = this.calculateAmountToSend();
|
||||
boolean drained = false;
|
||||
|
||||
for (FluidTankInfo tankInfo : tanksInfo) {
|
||||
if (tankInfo.fluid == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
FluidStack fluidStack = new FluidStack(tankInfo.fluid, Math.min(tankInfo.fluid.amount, maxDrain));
|
||||
fluidStack = fh.drain(this.getSide().getOpposite(), fluidStack, false);
|
||||
if (this.filterEnabled() && !this.isInFilter(fluidStack)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final AEFluidStack aeFluidStack = AEFluidStack.create(fluidStack);
|
||||
if (aeFluidStack != null) {
|
||||
final IAEFluidStack notInserted = inv
|
||||
.injectItems(aeFluidStack, Actionable.MODULATE, this.source);
|
||||
|
||||
if (notInserted != null && notInserted.getStackSize() > 0) {
|
||||
aeFluidStack.decStackSize(notInserted.getStackSize());
|
||||
}
|
||||
|
||||
fh.drain(this.getSide().getOpposite(), aeFluidStack.getFluidStack(), true);
|
||||
maxDrain -= aeFluidStack.getFluidStack().amount;
|
||||
drained = true;
|
||||
}
|
||||
}
|
||||
|
||||
return drained ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
} catch (GridAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return drained;
|
||||
}
|
||||
|
||||
return TickRateModulation.SLEEP;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDoBusWork() {
|
||||
return this.getProxy().isActive();
|
||||
protected boolean doOreDict(final Object myTarget, IMEMonitor<IAEFluidStack> inv, IEnergyGrid energy,
|
||||
FuzzyMode fzMode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPowerMultiplier() {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
private boolean isInFilter(FluidStack fluid) {
|
||||
for (int i = 0; i < this.getInventoryByName("config").getSizeInventory(); i++) {
|
||||
final IAEFluidStack stack = AEFluidStack
|
||||
.create(ItemFluidPacket.getFluidStack(this.getInventoryByName("config").getStackInSlot(i)));
|
||||
final IAEStackInventory inv = this.getAEInventoryByName(StorageName.NONE);
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
final IAEFluidStack stack = (IAEFluidStack) inv.getAEStackInSlot(i);
|
||||
if (stack != null && stack.getFluidStack().equals(fluid)) {
|
||||
return true;
|
||||
}
|
||||
@@ -132,74 +139,13 @@ public class PartFluidImportBus extends FCSharedFluidBus {
|
||||
}
|
||||
|
||||
private boolean filterEnabled() {
|
||||
for (int i = 0; i < this.getInventoryByName("config").getSizeInventory(); i++) {
|
||||
final IAEFluidStack stack = AEFluidStack
|
||||
.create(ItemFluidPacket.getFluidStack(this.getInventoryByName("config").getStackInSlot(i)));
|
||||
final IAEStackInventory inv = this.getAEInventoryByName(StorageName.NONE);
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
final IAEFluidStack stack = (IAEFluidStack) inv.getAEStackInSlot(i);
|
||||
if (stack != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneMode getRSMode() {
|
||||
return (RedstoneMode) this.getConfigManager().getSetting(Settings.REDSTONE_CONTROLLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderInventory(final IPartRenderHelper rh, final RenderBlocks renderer) {
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartImportSides.getIcon(),
|
||||
CableBusTextures.PartImportSides.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
this.getFaceIcon(),
|
||||
CableBusTextures.PartImportSides.getIcon(),
|
||||
CableBusTextures.PartImportSides.getIcon());
|
||||
|
||||
rh.setBounds(3, 3, 15, 13, 13, 16);
|
||||
rh.renderInventoryBox(renderer);
|
||||
|
||||
rh.setBounds(4, 4, 14, 12, 12, 15);
|
||||
rh.renderInventoryBox(renderer);
|
||||
|
||||
rh.setBounds(5, 5, 13, 11, 11, 14);
|
||||
rh.renderInventoryBox(renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderStatic(final int x, final int y, final int z, final IPartRenderHelper rh,
|
||||
final RenderBlocks renderer) {
|
||||
this.setRenderCache(rh.useSimplifiedRendering(x, y, z, this, this.getRenderCache()));
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartImportSides.getIcon(),
|
||||
CableBusTextures.PartImportSides.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
this.getFaceIcon(),
|
||||
CableBusTextures.PartImportSides.getIcon(),
|
||||
CableBusTextures.PartImportSides.getIcon());
|
||||
|
||||
rh.setBounds(4, 4, 14, 12, 12, 16);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
rh.setBounds(5, 5, 13, 11, 11, 14);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
rh.setBounds(6, 6, 12, 10, 10, 13);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
this.getFaceIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon());
|
||||
|
||||
rh.setBounds(6, 6, 11, 10, 10, 12);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
this.renderLights(x, y, z, rh, renderer);
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
package com.glodblock.github.common.parts.base;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.automation.PartUpgradeable;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class FCSharedFluidBus extends PartUpgradeable implements IGridTickable {
|
||||
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 9);
|
||||
private boolean lastRedstone;
|
||||
|
||||
public FCSharedFluidBus(ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
public abstract IIcon getFaceIcon();
|
||||
|
||||
@Override
|
||||
public void upgradesChanged() {
|
||||
this.updateState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged() {
|
||||
this.updateState();
|
||||
if (this.lastRedstone != this.getHost().hasRedstone(this.getSide())) {
|
||||
this.lastRedstone = !this.lastRedstone;
|
||||
if (this.lastRedstone && this.getRSMode() == RedstoneMode.SIGNAL_PULSE) {
|
||||
this.doBusWork();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateState() {
|
||||
try {
|
||||
if (!this.isSleeping()) {
|
||||
this.getProxy().getTick().wakeDevice(this.getProxy().getNode());
|
||||
} else {
|
||||
this.getProxy().getTick().sleepDevice(this.getProxy().getNode());
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate(final EntityPlayer player, final Vec3 pos) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if (Platform.isServer()) {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
this.getHost().getTile().getWorldObj(),
|
||||
new BlockPos(this.getHost().getTile()),
|
||||
Objects.requireNonNull(this.getSide()),
|
||||
GuiType.FLUID_BUS_IO);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes(IPartCollisionHelper bch) {
|
||||
bch.addBox(6, 6, 11, 10, 10, 13);
|
||||
bch.addBox(5, 5, 13, 11, 11, 14);
|
||||
bch.addBox(4, 4, 14, 12, 12, 16);
|
||||
}
|
||||
|
||||
protected TileEntity getConnectedTE() {
|
||||
TileEntity self = this.getHost().getTile();
|
||||
return this.getTileEntity(self, (new BlockPos(self)).getOffSet(this.getSide()));
|
||||
}
|
||||
|
||||
private TileEntity getTileEntity(final TileEntity self, final BlockPos pos) {
|
||||
final World w = self.getWorldObj();
|
||||
|
||||
if (w.getChunkProvider().chunkExists(pos.getX() >> 4, pos.getZ() >> 4)) {
|
||||
return w.getTileEntity(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public int calculateAmountToSend() {
|
||||
double amount = 1000D;
|
||||
switch (this.getInstalledUpgrades(Upgrades.SPEED)) {
|
||||
case 4:
|
||||
amount = amount * 1.5;
|
||||
case 3:
|
||||
amount = amount * 2;
|
||||
case 2:
|
||||
amount = amount * 4;
|
||||
case 1:
|
||||
amount = amount * 8;
|
||||
}
|
||||
switch (this.getInstalledUpgrades(Upgrades.SUPERSPEED)) {
|
||||
case 4:
|
||||
amount = amount * 8;
|
||||
case 3:
|
||||
amount = amount * 12;
|
||||
case 2:
|
||||
amount = amount * 16;
|
||||
case 1:
|
||||
amount = amount * 32;
|
||||
}
|
||||
return (int) Math.floor(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound extra) {
|
||||
super.readFromNBT(extra);
|
||||
this.config.readFromNBT(extra, "config");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound extra) {
|
||||
super.writeToNBT(extra);
|
||||
this.config.writeToNBT(extra, "config");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(String name) {
|
||||
if (name.equals("config")) {
|
||||
return this.config;
|
||||
}
|
||||
return super.getInventoryByName(name);
|
||||
}
|
||||
|
||||
public void setFluidInSlot(int id, IAEFluidStack fluid) {
|
||||
ItemStack tmp = ItemFluidPacket.newDisplayStack(fluid == null ? null : fluid.getFluidStack());
|
||||
this.config.setInventorySlotContents(id, tmp);
|
||||
}
|
||||
|
||||
protected StorageChannel getChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
}
|
||||
|
||||
protected abstract TickRateModulation doBusWork();
|
||||
|
||||
protected abstract boolean canDoBusWork();
|
||||
|
||||
@Override
|
||||
public int cableConnectionRenderTo() {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,11 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.integration.modules.waila.part.BasePartWailaDataProvider;
|
||||
import appeng.parts.automation.PartSharedItemBus;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class SpeedWailaDataProvider extends BasePartWailaDataProvider {
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(final EntityPlayerMP player, final IPart part, final TileEntity te,
|
||||
final NBTTagCompound tag, final World world, final int x, final int y, final int z) {
|
||||
if (part instanceof FCSharedFluidBus bus) {
|
||||
if (part instanceof PartSharedItemBus<?>bus) {
|
||||
tag.setInteger("BusSpeed", bus.calculateAmountToSend() / 5);
|
||||
}
|
||||
return tag;
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import com.glodblock.github.client.gui.GuiDualInterface;
|
||||
import com.glodblock.github.client.gui.GuiFluidAutoFiller;
|
||||
import com.glodblock.github.client.gui.GuiFluidIO;
|
||||
import com.glodblock.github.client.gui.GuiFluidInterface;
|
||||
import com.glodblock.github.client.gui.GuiFluidPacketDecoder;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternEncoder;
|
||||
@@ -23,7 +22,6 @@ import com.glodblock.github.client.gui.GuiOCPatternEditor;
|
||||
import com.glodblock.github.client.gui.GuiSuperStockReplenisher;
|
||||
import com.glodblock.github.client.gui.container.ContainerDualInterface;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidAutoFiller;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidIO;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidInterface;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPacketDecoder;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternEncoder;
|
||||
@@ -35,7 +33,6 @@ import com.glodblock.github.client.gui.container.ContainerLevelWireless;
|
||||
import com.glodblock.github.client.gui.container.ContainerMagnetFilter;
|
||||
import com.glodblock.github.client.gui.container.ContainerOCPatternEditor;
|
||||
import com.glodblock.github.client.gui.container.ContainerSuperStockReplenisher;
|
||||
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
|
||||
import com.glodblock.github.common.tile.TileFluidAutoFiller;
|
||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
import com.glodblock.github.common.tile.TileFluidPatternEncoder;
|
||||
@@ -133,19 +130,6 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_BUS_IO(new PartGuiFactory<>(FCSharedFluidBus.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, FCSharedFluidBus inv) {
|
||||
return new ContainerFluidIO(player.inventory, inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createClientGui(EntityPlayer player, FCSharedFluidBus inv) {
|
||||
return new GuiFluidIO(player.inventory, inv);
|
||||
}
|
||||
}),
|
||||
|
||||
INGREDIENT_BUFFER(new TileGuiFactory<>(TileIngredientBuffer.class) {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.client.gui.GuiFluidIO;
|
||||
import com.glodblock.github.client.gui.GuiFluidInterface;
|
||||
import com.glodblock.github.client.gui.GuiIngredientBuffer;
|
||||
import com.glodblock.github.client.gui.GuiLargeIngredientBuffer;
|
||||
@@ -86,10 +85,6 @@ public class SPacketFluidUpdate implements IMessage {
|
||||
for (Map.Entry<Integer, IAEFluidStack> e : message.list.entrySet()) {
|
||||
((GuiLargeIngredientBuffer) gs).update(e.getKey(), e.getValue());
|
||||
}
|
||||
} else if (gs instanceof GuiFluidIO) {
|
||||
for (Map.Entry<Integer, IAEFluidStack> e : message.list.entrySet()) {
|
||||
((GuiFluidIO) gs).update(e.getKey(), e.getValue());
|
||||
}
|
||||
} else if (gs instanceof GuiFluidInterface) {
|
||||
for (Map.Entry<Integer, IAEFluidStack> e : message.list.entrySet()) {
|
||||
((GuiFluidInterface) gs).update(e.getKey(), e.getValue());
|
||||
|
||||
Reference in new issue
Block a user