mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 18:44:42 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
ab0b8f11d4
commit
69a5c0e6ee
221 files changed
+3125
-2632
No files matched your search
@@ -1,12 +1,7 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.core.AELog;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import com.glodblock.github.util.Util;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
@@ -14,7 +9,16 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.core.AELog;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class AEFluidInventory implements IAEFluidTank {
|
||||
|
||||
private final IAEFluidStack[] fluids;
|
||||
private final IAEFluidInventory handler;
|
||||
private final int capacity;
|
||||
@@ -33,8 +37,7 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
@Override
|
||||
public void setFluidInSlot(final int slot, final IAEFluidStack fluid) {
|
||||
if (slot >= 0 && slot < this.getSlots()) {
|
||||
if (fluid != null
|
||||
&& this.fluids[slot] != null
|
||||
if (fluid != null && this.fluids[slot] != null
|
||||
&& fluid.getFluidStack().isFluidEqual(this.fluids[slot].getFluidStack())) {
|
||||
if (fluid.getStackSize() != this.fluids[slot].getStackSize()) {
|
||||
this.fluids[slot].setStackSize(Math.min(fluid.getStackSize(), this.capacity));
|
||||
@@ -299,8 +302,7 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
}
|
||||
|
||||
target.setTag("#" + x, c);
|
||||
} catch (final Exception ignored) {
|
||||
}
|
||||
} catch (final Exception ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,6 +329,7 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
}
|
||||
|
||||
private class FluidTankPropertiesWrapper implements IFluidTank {
|
||||
|
||||
private final int slot;
|
||||
|
||||
public FluidTankPropertiesWrapper(final int slot) {
|
||||
@@ -335,8 +338,7 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
|
||||
@Override
|
||||
public FluidStack getFluid() {
|
||||
return AEFluidInventory.this.fluids[this.slot] == null
|
||||
? null
|
||||
return AEFluidInventory.this.fluids[this.slot] == null ? null
|
||||
: AEFluidInventory.this.fluids[this.slot].getFluidStack();
|
||||
}
|
||||
|
||||
@@ -366,9 +368,8 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
acc = Math.max(resource.amount, getCapacity() - getFluid().amount);
|
||||
}
|
||||
if (doFill) {
|
||||
if (getFluid() == null)
|
||||
AEFluidInventory.this.setFluidInSlot(
|
||||
this.slot, AEFluidStack.create(new FluidStack(resource.getFluid(), acc)));
|
||||
if (getFluid() == null) AEFluidInventory.this
|
||||
.setFluidInSlot(this.slot, AEFluidStack.create(new FluidStack(resource.getFluid(), acc)));
|
||||
else getFluid().amount += acc;
|
||||
}
|
||||
return acc;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
public class AeItemStackHandler implements IInventory {
|
||||
|
||||
private final AeStackInventory<IAEItemStack> inv;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
public interface AeStackInventory<T extends IAEStack<T>> extends Iterable<T> {
|
||||
|
||||
int getSlotCount();
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
import com.glodblock.github.util.ObjectArrayIterator;
|
||||
import com.glodblock.github.util.Util;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
public class AeStackInventoryImpl<T extends IAEStack<T>> implements AeStackInventory<T> {
|
||||
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.InsertionMode;
|
||||
import appeng.me.GridAccessException;
|
||||
@@ -9,6 +23,7 @@ import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.inv.IInventoryDestination;
|
||||
import appeng.util.inv.ItemSlot;
|
||||
import cofh.api.transport.IItemDuct;
|
||||
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.parts.PartFluidExportBus;
|
||||
@@ -18,27 +33,11 @@ import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.Util;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
|
||||
public FluidConvertingInventoryAdaptor(
|
||||
@Nullable InventoryAdaptor invItems,
|
||||
@Nullable IFluidHandler invFluids,
|
||||
ForgeDirection facing,
|
||||
BlockPos pos,
|
||||
boolean isOnmi,
|
||||
Object eioConduct) {
|
||||
public FluidConvertingInventoryAdaptor(@Nullable InventoryAdaptor invItems, @Nullable IFluidHandler invFluids,
|
||||
ForgeDirection facing, BlockPos pos, boolean isOnmi, Object eioConduct) {
|
||||
this.invItems = invItems;
|
||||
this.invFluids = invFluids;
|
||||
this.side = facing;
|
||||
@@ -56,16 +55,13 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
|
||||
public static InventoryAdaptor wrap(TileEntity capProvider, ForgeDirection face) {
|
||||
// sometimes i wish 1.7.10 has cap system.
|
||||
TileEntity inter = capProvider
|
||||
.getWorldObj()
|
||||
.getTileEntity(
|
||||
capProvider.xCoord + face.offsetX,
|
||||
capProvider.yCoord + face.offsetY,
|
||||
capProvider.zCoord + face.offsetZ);
|
||||
if (!Config.noFluidPacket
|
||||
&& !(inter instanceof TileFluidInterface
|
||||
|| Util.getPart(inter, face.getOpposite()) instanceof PartFluidInterface
|
||||
|| Util.getPart(inter, face.getOpposite()) instanceof PartFluidExportBus))
|
||||
TileEntity inter = capProvider.getWorldObj().getTileEntity(
|
||||
capProvider.xCoord + face.offsetX,
|
||||
capProvider.yCoord + face.offsetY,
|
||||
capProvider.zCoord + face.offsetZ);
|
||||
if (!Config.noFluidPacket && !(inter instanceof TileFluidInterface
|
||||
|| Util.getPart(inter, face.getOpposite()) instanceof PartFluidInterface
|
||||
|| Util.getPart(inter, face.getOpposite()) instanceof PartFluidExportBus))
|
||||
return InventoryAdaptor.getAdaptor(capProvider, face);
|
||||
InventoryAdaptor item = InventoryAdaptor.getAdaptor(capProvider, face);
|
||||
IFluidHandler fluid = capProvider instanceof IFluidHandler ? (IFluidHandler) capProvider : null;
|
||||
@@ -155,14 +151,14 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeSimilarItems(
|
||||
int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination) {
|
||||
public ItemStack removeSimilarItems(int amount, ItemStack filter, FuzzyMode fuzzyMode,
|
||||
IInventoryDestination destination) {
|
||||
return invItems != null ? invItems.removeSimilarItems(amount, filter, fuzzyMode, destination) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateSimilarRemove(
|
||||
int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination) {
|
||||
public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode,
|
||||
IInventoryDestination destination) {
|
||||
return invItems != null ? invItems.simulateSimilarRemove(amount, filter, fuzzyMode, destination) : null;
|
||||
}
|
||||
|
||||
@@ -193,8 +189,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
if (target == null) continue;
|
||||
tankInfos.add(target.getTankInfo(p2p.getSide().getOpposite()));
|
||||
}
|
||||
} catch (GridAccessException ignore) {
|
||||
}
|
||||
} catch (GridAccessException ignore) {}
|
||||
} else {
|
||||
tankInfos.add(invFluids.getTankInfo(this.side));
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
|
||||
public class FluidConvertingInventoryCrafting extends InventoryCrafting {
|
||||
|
||||
public FluidConvertingInventoryCrafting(Container container, int width, int height) {
|
||||
@@ -23,7 +24,8 @@ public class FluidConvertingInventoryCrafting extends InventoryCrafting {
|
||||
} else {
|
||||
// wtf?
|
||||
super.setInventorySlotContents(
|
||||
index, ItemFluidPacket.newStack(new FluidStack(FluidRegistry.WATER, 1000)));
|
||||
index,
|
||||
ItemFluidPacket.newStack(new FluidStack(FluidRegistry.WATER, 1000)));
|
||||
}
|
||||
} else {
|
||||
super.setInventorySlotContents(index, stack);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
public interface IAEFluidInventory {
|
||||
|
||||
void onFluidInventoryChanged(final IAEFluidTank inv, final int slot);
|
||||
|
||||
AEFluidInventory getInternalFluid();
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
|
||||
public interface IAEFluidTank extends IFluidHandler {
|
||||
|
||||
void setFluidInSlot(final int slot, final IAEFluidStack fluid);
|
||||
|
||||
IAEFluidStack getFluidInSlot(final int slot);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
|
||||
import com.glodblock.github.util.DualityFluidInterface;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public interface IDualHost extends IFluidHandler, IAEFluidInventory {
|
||||
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.network.CPacketSwitchGuis;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class InventoryHandler implements IGuiHandler {
|
||||
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -12,13 +19,9 @@ import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import java.util.*;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
|
||||
|
||||
private final IFluidHandler handler;
|
||||
private final ForgeDirection side;
|
||||
private IItemList<IAEFluidStack> cache = AEApi.instance().storage().createFluidList();
|
||||
|
||||
+7
-5
@@ -1,13 +1,15 @@
|
||||
package com.glodblock.github.inventory.external;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
||||
|
||||
@@ -30,9 +32,9 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
||||
return ((ITileStorageMonitorable) te).getMonitorable(d, src).getFluidInventory();
|
||||
} else if (Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable
|
||||
&& ((ITileStorageMonitorable) Util.getPart(te, d.getOpposite())).getMonitorable(d, src) != null) {
|
||||
ITileStorageMonitorable part = (ITileStorageMonitorable) Util.getPart(te, d.getOpposite());
|
||||
return part.getMonitorable(d, src).getFluidInventory();
|
||||
}
|
||||
ITileStorageMonitorable part = (ITileStorageMonitorable) Util.getPart(te, d.getOpposite());
|
||||
return part.getMonitorable(d, src).getFluidInventory();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,13 +1,15 @@
|
||||
package com.glodblock.github.inventory.external;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
|
||||
import com.glodblock.github.inventory.MEMonitorIFluidHandler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
// This handler is too generic, so it will overlap other mods' fluid handler.
|
||||
// It will be injected into external handler by ASM to make sure it is executed at last.
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package com.glodblock.github.inventory.gui;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.ITankDump;
|
||||
import com.glodblock.github.network.CPacketDumpTank;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
||||
public class ButtonMouseHandler implements MouseRegionManager.Handler {
|
||||
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
package com.glodblock.github.inventory.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.implementations.ContainerCraftAmount;
|
||||
import appeng.container.implementations.ContainerCraftingStatus;
|
||||
import appeng.container.implementations.ContainerPriority;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
|
||||
import com.glodblock.github.client.gui.*;
|
||||
import com.glodblock.github.client.gui.container.*;
|
||||
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
|
||||
@@ -16,12 +23,11 @@ import com.glodblock.github.common.tile.*;
|
||||
import com.glodblock.github.inventory.IDualHost;
|
||||
import com.glodblock.github.inventory.item.IFluidPortableCell;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public enum GuiType {
|
||||
|
||||
FLUID_LEVEL_EMITTER(new PartGuiFactory<PartFluidLevelEmitter>(PartFluidLevelEmitter.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, PartFluidLevelEmitter inv) {
|
||||
return new ContainerFluidLevelEmitter(player.inventory, inv);
|
||||
@@ -34,6 +40,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
LEVEL_MAINTAINER(new TileGuiFactory<TileLevelMaintainer>(TileLevelMaintainer.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileLevelMaintainer inv) {
|
||||
return new ContainerLevelMaintainer(player.inventory, inv);
|
||||
@@ -46,6 +53,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
OC_PATTERN_EDITOR(new TileGuiFactory<TileOCPatternEditor>(TileOCPatternEditor.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileOCPatternEditor inv) {
|
||||
return new ContainerOCPatternEditor(player.inventory, inv);
|
||||
@@ -58,6 +66,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
DUAL_INTERFACE(new TileOrPartGuiFactory<IInterfaceHost>(IInterfaceHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IInterfaceHost inv) {
|
||||
return new ContainerDualInterface(player.inventory, inv);
|
||||
@@ -70,6 +79,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
DUAL_INTERFACE_FLUID(new TileOrPartGuiFactory<IDualHost>(IDualHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IDualHost inv) {
|
||||
return new ContainerFluidInterface(player.inventory, inv);
|
||||
@@ -82,6 +92,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
PRIORITY(new TileOrPartGuiFactory<IPriorityHost>(IPriorityHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IPriorityHost inv) {
|
||||
return new ContainerPriority(player.inventory, inv);
|
||||
@@ -94,6 +105,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
FLUID_BUS_IO(new PartGuiFactory<FCSharedFluidBus>(FCSharedFluidBus.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, FCSharedFluidBus inv) {
|
||||
return new ContainerFluidIO(player.inventory, inv);
|
||||
@@ -106,6 +118,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
FLUID_STORAGE_BUS(new PartGuiFactory<PartFluidStorageBus>(PartFluidStorageBus.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, PartFluidStorageBus inv) {
|
||||
return new ContainerFluidStorageBus(player.inventory, inv);
|
||||
@@ -118,6 +131,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
INGREDIENT_BUFFER(new TileGuiFactory<TileIngredientBuffer>(TileIngredientBuffer.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileIngredientBuffer inv) {
|
||||
return new ContainerIngredientBuffer(player.inventory, inv);
|
||||
@@ -130,6 +144,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
LARGE_INGREDIENT_BUFFER(new TileGuiFactory<TileLargeIngredientBuffer>(TileLargeIngredientBuffer.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileLargeIngredientBuffer inv) {
|
||||
return new ContainerLargeIngredientBuffer(player.inventory, inv);
|
||||
@@ -142,6 +157,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
CRAFTING_STATUS(new PartGuiFactory<FCPart>(FCPart.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, FCPart inv) {
|
||||
return new ContainerCraftingStatus(player.inventory, inv);
|
||||
@@ -154,6 +170,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
FLUID_TERMINAL(new TileOrPartGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
return new ContainerFluidMonitor(player.inventory, inv);
|
||||
@@ -166,6 +183,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
PORTABLE_FLUID_CELL(new ItemGuiFactory<IFluidPortableCell>(IFluidPortableCell.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IFluidPortableCell inv) {
|
||||
return new ContainerFluidPortableCell(player.inventory, inv);
|
||||
@@ -178,6 +196,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
FLUID_PATTERN_TERMINAL(new PartGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
return new ContainerFluidPatternTerminal(player.inventory, inv);
|
||||
@@ -190,6 +209,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
FLUID_PATTERN_TERMINAL_EX(new PartGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
return new ContainerFluidPatternTerminalEx(player.inventory, inv);
|
||||
@@ -202,6 +222,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
FLUID_PATTERN_ENCODER(new TileGuiFactory<TileFluidPatternEncoder>(TileFluidPatternEncoder.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileFluidPatternEncoder inv) {
|
||||
return new ContainerFluidPatternEncoder(player.inventory, inv);
|
||||
@@ -214,6 +235,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
FLUID_CRAFTING_CONFIRM(new PartGuiFactory<FCPart>(FCPart.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, FCPart inv) {
|
||||
return new ContainerFluidCraftConfirm(player.inventory, inv);
|
||||
@@ -226,6 +248,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
FLUID_CRAFTING_AMOUNT(new PartGuiFactory<FCPart>(FCPart.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, FCPart inv) {
|
||||
return new ContainerCraftAmount(player.inventory, inv);
|
||||
@@ -238,6 +261,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
FLUID_PACKET_DECODER(new TileGuiFactory<TileFluidPacketDecoder>(TileFluidPacketDecoder.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileFluidPacketDecoder inv) {
|
||||
return new ContainerFluidPacketDecoder(player.inventory, inv);
|
||||
@@ -250,6 +274,7 @@ public enum GuiType {
|
||||
}),
|
||||
|
||||
PATTERN_VALUE_SET(new PartGuiFactory<FCPart>(FCPart.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, FCPart inv) {
|
||||
return new ContainerPatternValueAmount(player.inventory, inv);
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package com.glodblock.github.inventory.gui;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IGuiFactory {
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.glodblock.github.inventory.gui;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import com.glodblock.github.inventory.item.IItemInventory;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
|
||||
import com.glodblock.github.inventory.item.IItemInventory;
|
||||
|
||||
public abstract class ItemGuiFactory<T> implements IGuiFactory {
|
||||
|
||||
protected final Class<T> invClass;
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package com.glodblock.github.inventory.gui;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
|
||||
public class MouseRegionManager {
|
||||
|
||||
private final GuiContainer gui;
|
||||
private final List<Region> regions = new ArrayList<>();
|
||||
|
||||
@@ -25,8 +29,7 @@ public class MouseRegionManager {
|
||||
mY -= gui.guiTop;
|
||||
for (Region region : regions) {
|
||||
if (region.containsMouse(mX, mY) && region.handler.onClick(button)) {
|
||||
gui.mc
|
||||
.getSoundHandler()
|
||||
gui.mc.getSoundHandler()
|
||||
.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1F));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.glodblock.github.inventory.gui;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public abstract class PartGuiFactory<T> extends TileGuiFactory<T> {
|
||||
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
package com.glodblock.github.inventory.gui;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
public class TankMouseHandler implements MouseRegionManager.Handler {
|
||||
|
||||
private final IAEFluidTank tank;
|
||||
@@ -26,10 +30,9 @@ public class TankMouseHandler implements MouseRegionManager.Handler {
|
||||
IAEFluidStack fluid = tank.getFluidInSlot(index);
|
||||
return Arrays.asList(
|
||||
fluid != null ? fluid.getFluidStack().getLocalizedName() : I18n.format(NameConst.TT_EMPTY),
|
||||
EnumChatFormatting.GRAY
|
||||
+ String.format(
|
||||
"%,d / %,d mB",
|
||||
fluid != null ? fluid.getStackSize() : 0L,
|
||||
tank.getTankInfo(ForgeDirection.UNKNOWN)[index].capacity));
|
||||
EnumChatFormatting.GRAY + String.format(
|
||||
"%,d / %,d mB",
|
||||
fluid != null ? fluid.getStackSize() : 0L,
|
||||
tank.getTankInfo(ForgeDirection.UNKNOWN)[index].capacity));
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.glodblock.github.inventory.gui;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
|
||||
public abstract class TileGuiFactory<T> implements IGuiFactory {
|
||||
|
||||
protected final Class<T> invClass;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.glodblock.github.inventory.gui;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public abstract class TileOrPartGuiFactory<T> extends TileGuiFactory<T> {
|
||||
|
||||
|
||||
@@ -5,4 +5,5 @@ import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.interfaces.IInventorySlotAware;
|
||||
|
||||
public interface IFluidPortableCell extends ITerminalHost, IInventorySlotAware, IEnergySource, IGuiItemObject {}
|
||||
public interface IFluidPortableCell extends ITerminalHost, IInventorySlotAware, IEnergySource, IGuiItemObject {
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.glodblock.github.inventory.item;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
@@ -9,10 +14,8 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.glodblock.github.common.storage.FluidCellInventory;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class PortableFluidCellInventory extends MEMonitorHandler<IAEFluidStack> implements IFluidPortableCell {
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.glodblock.github.inventory.slot;
|
||||
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
|
||||
public class FCSlotRestrictedInput extends SlotRestrictedInput {
|
||||
|
||||
private ItemStack valid;
|
||||
|
||||
public FCSlotRestrictedInput(ItemStack valid, IInventory i, int slotIndex, int x, int y, InventoryPlayer p) {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.glodblock.github.inventory.slot;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
public interface ISlotFluid {
|
||||
|
||||
@Nullable
|
||||
|
||||
+7
-13
@@ -1,29 +1,23 @@
|
||||
package com.glodblock.github.inventory.slot;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import appeng.container.slot.IOptionalSlotHost;
|
||||
import appeng.container.slot.OptionalSlotFakeTypeOnly;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.util.Util;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class OptionalFluidSlotFakeTypeOnly extends OptionalSlotFakeTypeOnly {
|
||||
|
||||
AEFluidInventory fluidInv;
|
||||
|
||||
public OptionalFluidSlotFakeTypeOnly(
|
||||
IInventory inv,
|
||||
AEFluidInventory fluidInv,
|
||||
IOptionalSlotHost containerBus,
|
||||
int idx,
|
||||
int x,
|
||||
int y,
|
||||
int offX,
|
||||
int offY,
|
||||
int groupNum) {
|
||||
public OptionalFluidSlotFakeTypeOnly(IInventory inv, AEFluidInventory fluidInv, IOptionalSlotHost containerBus,
|
||||
int idx, int x, int y, int offX, int offY, int groupNum) {
|
||||
super(inv, containerBus, idx, x, y, offX, offY, groupNum);
|
||||
this.fluidInv = fluidInv;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
package com.glodblock.github.inventory.slot;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.AeItemStackHandler;
|
||||
import com.glodblock.github.inventory.AeStackInventory;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.AeItemStackHandler;
|
||||
import com.glodblock.github.inventory.AeStackInventory;
|
||||
|
||||
public class SlotFluidConvertingFake extends SlotFake implements ISlotFluid {
|
||||
|
||||
private final AeStackInventory<IAEItemStack> inv;
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package com.glodblock.github.inventory.slot;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SlotSingleItem extends Slot {
|
||||
|
||||
private final Slot delegate;
|
||||
|
||||
Reference in new issue
Block a user