Compare commits

..
27 changed files with 459 additions and 424 deletions

No files matched your search

+8 -8
View File
@@ -34,30 +34,30 @@
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
api('com.github.GTNewHorizons:NotEnoughItems:2.7.80-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-684-GTNH:dev')
api('com.github.GTNewHorizons:NotEnoughItems:2.7.72-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-672-GTNH-pre:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.8.12:dev')
api("com.github.GTNewHorizons:GTNHLib:0.6.39:dev")
api("com.github.GTNewHorizons:GTNHLib:0.6.38:dev")
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.7:dev") {
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.1.13-GTNH:dev')
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.1.9-GTNH:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.17:dev')
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.16:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.22:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.446:dev') {
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.423:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.18-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.16-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.11-GTNH:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.102:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.96:dev") { transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev")
}
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.42'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.41'
}
@@ -22,13 +22,11 @@ import com.glodblock.github.util.Ae2ReflectClient;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.AEBaseContainer;
import appeng.helpers.InventoryAction;
public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraftingStatus {
private GuiTabButton originalGuiBtn;
private final ITerminalHost host;
public GuiCraftingStatus(InventoryPlayer inventoryPlayer, ITerminalHost te) {
@@ -38,26 +36,21 @@ public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraf
@Override
public void initGui() {
if (host instanceof PartFluidPatternTerminal)
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.FLUID_TERMINAL.stack());
else if (host instanceof PartFluidPatternTerminalEx)
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.FLUID_TERMINAL_EX.stack());
else if (host instanceof PartFluidTerminal)
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.FLUID_TERM.stack());
else if (host instanceof PartLevelTerminal)
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.LEVEL_TERMINAL.stack());
if (host instanceof PartFluidPatternTerminal) this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL.stack();
else if (host instanceof PartFluidPatternTerminalEx) this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL_EX.stack();
else if (host instanceof PartFluidTerminal) this.myIcon = ItemAndBlockHolder.FLUID_TERM.stack();
else if (host instanceof PartLevelTerminal) this.myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host))
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack());
this.myIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
else if (host instanceof WirelessFluidTerminalInventory)
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_FLUID_TERM.stack());
this.myIcon = ItemAndBlockHolder.WIRELESS_FLUID_TERM.stack();
else if (host instanceof WirelessPatternTerminalInventory)
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack());
this.myIcon = ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack();
else if (host instanceof WirelessInterfaceTerminalInventory)
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_INTERFACE_TERM.stack());
this.myIcon = ItemAndBlockHolder.WIRELESS_INTERFACE_TERM.stack();
else if (host instanceof WirelessLevelTerminalInventory)
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack());
this.myIcon = ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack();
super.initGui();
originalGuiBtn = Ae2ReflectClient.getOriginalGuiButton(this);
}
@Override
@@ -92,7 +85,7 @@ public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraf
new CPacketInventoryAction(
InventoryAction.AUTO_CRAFT,
Ae2ReflectClient.getInventorySlots(this).size(),
hoveredAEStack.getStackSize(),
0,
hoveredAEStack));
return;
}
@@ -55,7 +55,6 @@ public class GuiFCPriority extends FCGuiAmount {
protected void addQty(final int i) {
try {
this.amountBox.setText(Long.toString(getAmount() + i));
this.amountBox.setCursorPositionEnd();
} catch (final NumberFormatException ignore) {}
try {
NetworkHandler.instance
@@ -45,7 +45,9 @@ public class GuiFluidCraftAmount extends FCGuiAmount {
this.guiTop + 53,
Settings.CRAFTING_MODE,
CraftingMode.STANDARD));
((ContainerCraftAmount) this.inventorySlots).setAmountField(this.amountBox);
this.amountBox.setText("1");
this.amountBox.setSelectionPos(0);
}
@Override
@@ -1,6 +1,7 @@
package com.glodblock.github.client.gui.base;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
@@ -11,7 +12,6 @@ import com.glodblock.github.inventory.gui.GuiType;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.container.AEBaseContainer;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
@@ -20,7 +20,7 @@ import appeng.util.calculators.Calculator;
public abstract class FCGuiAmount extends AEBaseGui {
protected MEGuiTextField amountBox;
protected GuiTextField amountBox;
protected GuiTabButton originalGuiBtn;
protected GuiButton submit;
protected GuiButton plus1;
@@ -72,10 +72,16 @@ public abstract class FCGuiAmount extends AEBaseGui {
this.originalGuiBtn.setHideEdge(13);
}
this.amountBox = new MEGuiTextField(61, 12);
this.amountBox.x = this.guiLeft + 60;
this.amountBox.y = this.guiTop + 55;
this.amountBox = new GuiTextField(
this.fontRendererObj,
this.guiLeft + 62,
this.guiTop + 57,
59,
this.fontRendererObj.FONT_HEIGHT);
this.amountBox.setEnableBackgroundDrawing(false);
this.amountBox.setMaxStringLength(16);
this.amountBox.setTextColor(0xFFFFFF);
this.amountBox.setVisible(true);
this.amountBox.setFocused(true);
}
@@ -128,7 +134,6 @@ public abstract class FCGuiAmount extends AEBaseGui {
}
String out = Long.toString(resultI);
this.amountBox.setText(out);
this.amountBox.setCursorPositionEnd();
} catch (final NumberFormatException ignore) {}
}
@@ -149,7 +149,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
@Override
protected void actionPerformed(final GuiButton btn) {
memoryText = this.searchField.getText();
if (btn == this.craftingStatusBtn || btn == this.craftingStatusImgBtn) {
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
}
@@ -183,6 +182,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
iBtn.set(next);
if (next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class) {
memoryText = this.searchField.getText();
super.scheduleGuiResize();
}
}
@@ -501,7 +501,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
action = InventoryAction.PICKUP_SINGLE;
}
}
if (Ae2ReflectClient.getDragClick(this).size() > 1) {
if (this.drag_click.size() > 1) {
return;
}
final PacketInventoryAction p = new PacketInventoryAction(action, slotIdx, 0);
@@ -552,7 +552,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
if (slot instanceof SlotDisconnected) {
if (Ae2ReflectClient.getDragClick(this).size() > 1) {
if (this.drag_click.size() > 1) {
return;
}
InventoryAction action = null;
@@ -13,11 +13,9 @@ import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.BlockPos;
import appeng.api.networking.IGrid;
import appeng.api.networking.crafting.ICraftingJob;
import appeng.api.networking.security.IActionHost;
import appeng.api.storage.ITerminalHost;
import appeng.container.implementations.ContainerCraftConfirm;
@@ -71,8 +69,8 @@ public class ContainerFluidCraftConfirm extends ContainerCraftConfirm {
@Override
public void optimizePatterns() {
// only V2 supported
IGrid grid = Ae2Reflect.getGrid(this);
ICraftingJob result = Ae2Reflect.getResult(this);
IGrid grid = this.getGrid();
if (result instanceof CraftingJobV2 && !this.isSimulation()
&& grid != null
&& !grid.getMachines(TilePatternOptimizationMatrix.class).isEmpty()) {
@@ -5,7 +5,6 @@ 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.util.Ae2Reflect;
import appeng.api.config.SchedulingMode;
import appeng.api.config.Settings;
@@ -34,7 +33,7 @@ public class ContainerFluidIO extends FCContainerFluidConfigurable {
@Override
protected void loadSettingsFromHost(IConfigManager cm) {
super.loadSettingsFromHost(cm);
if (Ae2Reflect.getUpgradeableHost(this) instanceof PartFluidExportBus) {
if (this.getUpgradeable() instanceof PartFluidExportBus) {
this.setCraftingMode((YesNo) cm.getSetting(Settings.CRAFT_ONLY));
this.setSchedulingMode((SchedulingMode) cm.getSetting(Settings.SCHEDULING_MODE));
}
@@ -7,12 +7,10 @@ import net.minecraft.inventory.IInventory;
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.util.Ae2Reflect;
import appeng.api.config.RedstoneMode;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
import appeng.api.implementations.IUpgradeableHost;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.container.guisync.GuiSync;
import appeng.tile.inventory.AppEngInternalAEInventory;
@@ -39,10 +37,6 @@ public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
return this.lvlEmitter;
}
protected IUpgradeableHost getUpgradeable() {
return Ae2Reflect.getUpgradeableHost(this);
}
public AppEngInternalAEInventory getFakeFluidInv() {
return (AppEngInternalAEInventory) this.lvlEmitter.getInventoryByName("config");
}
@@ -84,8 +78,7 @@ public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
if (Platform.isServer()) {
this.EmitterValue = this.lvlEmitter.getReportingValue();
this.setRedStoneMode(
(RedstoneMode) Ae2Reflect.getUpgradeableHost(this).getConfigManager()
.getSetting(Settings.REDSTONE_EMITTER));
(RedstoneMode) this.getUpgradeable().getConfigManager().getSetting(Settings.REDSTONE_EMITTER));
}
this.standardDetectAndSendChanges();
@@ -9,7 +9,6 @@ import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurab
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.parts.PartFluidStorageBus;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.util.Ae2Reflect;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
@@ -51,8 +50,8 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
protected void setupConfig() {
final int xo = 8;
final int yo = 23 + 6;
final IInventory upgrades = Ae2Reflect.getUpgradeList(this).getInventoryByName("upgrades");
final IInventory config = Ae2Reflect.getUpgradeList(this).getInventoryByName("config");
final IInventory upgrades = getUpgradeable().getInventoryByName("upgrades");
final IInventory config = getUpgradeable().getInventoryByName("config");
for (int y = 0; y < 7; y++) {
for (int x = 0; x < 9; x++) {
this.addSlotToContainer(
@@ -104,7 +103,7 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
@Override
protected boolean isValidForConfig(int slot, IAEFluidStack fs) {
if (this.supportCapacity()) {
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.CAPACITY);
final int upgrades = getUpgradeable().getInstalledUpgrades(Upgrades.CAPACITY);
final int y = slot / 9;
return y < upgrades + 2;
}
@@ -126,11 +125,9 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
this.verifyPermissions(SecurityPermissions.BUILD, false);
if (Platform.isServer()) {
this.setReadWriteMode(
(AccessRestriction) Ae2Reflect.getUpgradeList(this).getConfigManager().getSetting(Settings.ACCESS));
this.setReadWriteMode((AccessRestriction) getUpgradeable().getConfigManager().getSetting(Settings.ACCESS));
this.setStorageFilter(
(StorageFilter) Ae2Reflect.getUpgradeList(this).getConfigManager()
.getSetting(Settings.STORAGE_FILTER));
(StorageFilter) getUpgradeable().getConfigManager().getSetting(Settings.STORAGE_FILTER));
}
this.standardDetectAndSendChanges();
@@ -138,8 +135,8 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
@Override
public boolean isSlotEnabled(final int idx) {
if (Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.ORE_FILTER) > 0) return false;
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.CAPACITY);
if (getUpgradeable().getInstalledUpgrades(Upgrades.ORE_FILTER) > 0) return false;
final int upgrades = getUpgradeable().getInstalledUpgrades(Upgrades.CAPACITY);
return upgrades > (idx - 2);
}
@@ -14,7 +14,6 @@ import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.network.SPacketFluidUpdate;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.Util;
import appeng.api.config.Upgrades;
@@ -64,7 +63,7 @@ public abstract class FCContainerFluidConfigurable extends ContainerUpgradeable
protected void setupConfig() {
this.setupUpgrades();
final IInventory inv = Ae2Reflect.getUpgradeList(this).getInventoryByName("config");
final IInventory inv = getUpgradeable().getInventoryByName("config");
final int y = 40;
final int x = 80;
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 0, x, y, 0, 0, 0));
@@ -84,7 +83,7 @@ public abstract class FCContainerFluidConfigurable extends ContainerUpgradeable
protected boolean isValidForConfig(int slot, IAEFluidStack fs) {
if (this.supportCapacity()) {
// assumes 4 slots per upgrade
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.CAPACITY);
final int upgrades = getUpgradeable().getInstalledUpgrades(Upgrades.CAPACITY);
if (slot > 0 && upgrades < 1) {
return false;
@@ -145,7 +145,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
}
if (handler.isPreformatted()) {
final String list = (handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included
final String list = (handler.getWhitelist() == IncludeExclude.WHITELIST ? GuiText.Included
: GuiText.Excluded).getLocal();
lines.add(GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Precise.getLocal());
@@ -17,6 +17,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
@@ -35,6 +36,7 @@ import com.google.common.collect.ImmutableSet;
import appeng.api.config.Actionable;
import appeng.api.config.Upgrades;
import appeng.api.implementations.items.IMemoryCard;
import appeng.api.implementations.tiles.ITileStorageMonitorable;
import appeng.api.networking.IGridNode;
import appeng.api.networking.crafting.ICraftingLink;
@@ -67,11 +69,8 @@ import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
import appeng.util.inv.AdaptorIInventory;
import appeng.util.inv.IInventoryDestination;
import appeng.util.inv.WrapperInvSlot;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInterface>
implements IGridTickable, IStorageMonitorable, IInventoryDestination, IDualHost, ISidedInventory,
@@ -80,10 +79,6 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
boolean needUpdateOnNetworkBooted = false;
boolean lastPowerStart = false;
public PartFluidP2PInterface(ItemStack is) {
super(is);
}
private final DualityInterface duality = new DualityInterface(this.getProxy(), this) {
@Override
@@ -116,7 +111,6 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
}
}
@Override
public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall) {
final boolean powerState = proxy.isActive();
if (needUpdateOnNetworkBooted || lastPowerStart != powerState) {
@@ -142,7 +136,6 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
if (p2p != null) {
this.setHasConfig(p2p.duality.hasConfig());
alertDevice = hasWorkToDo();
} else {
@@ -171,7 +164,7 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
super.addDrops(drops);
try {
for (PartFluidP2PInterface p2p : getOutputs()) p2p.duality.addDrops(drops);
} catch (GridAccessException ignored) {}
} catch (GridAccessException e) {}
} else {
if (this.getWaitingToSend() != null) {
for (final ItemStack is : this.getWaitingToSend()) {
@@ -210,46 +203,29 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
private final DualityFluidInterface dualityFluid = new DualityFluidInterface(this.getProxy(), this);
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 6);
public PartFluidP2PInterface(ItemStack is) {
super(is);
}
private void updateSharingInventory() {
duality.readConfig();
if (isOutput()) {
PartFluidP2PInterface p2p = getInput();
if (proxy.isActive() && p2p != null) {
if (!duality.sharedInventory && !duality.getStorage().isEmpty()) {
ArrayList<ItemStack> drops = new ArrayList<>();
AppEngInternalInventory storageAppEng = this.duality.getStorage();
AdaptorIInventory p2pInv = new AdaptorIInventory(p2p.duality.getStorage());
for (ItemStack itemStack : storageAppEng) {
if (itemStack == null) continue;
ItemStack drop = p2pInv.addItems(itemStack);
if (drop != null && drop.stackSize > 0) {
drops.add(drop);
}
}
TileEntity te = getTileEntity();
Platform.spawnDrops(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, drops);
}
duality.setStorage(p2p.duality.getStorage());
duality.sharedInventory = true;
} else {
if (duality.sharedInventory) {
duality.setStorage(new AppEngInternalInventory(this, NUMBER_OF_STORAGE_SLOTS));
duality.setSlotInv(new WrapperInvSlot(duality.getStorage()));
duality.sharedInventory = false;
}
}
} else {
if (duality.sharedInventory) {
duality.setStorage(new AppEngInternalInventory(this, NUMBER_OF_STORAGE_SLOTS));
duality.setSlotInv(new WrapperInvSlot(duality.getStorage()));
duality.sharedInventory = false;
}
} else {
try {
for (PartFluidP2PInterface p2p : getOutputs()) {
p2p.duality.readConfig();
}
} catch (GridAccessException ignored) {}
}
duality.readConfig();
}
@MENetworkEventSubscribe
@@ -266,90 +242,51 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
needUpdateOnNetworkBooted = true;
}
@Override
public int getInstalledUpgrades(final Upgrades u) {
return this.duality.getInstalledUpgrades(u);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getTypeTexture() {
return ItemAndBlockHolder.INTERFACE.getBlockTextureFromSide(0);
}
@Override
public void gridChanged() {
super.gridChanged();
dualityFluid.gridChanged();
}
@Override
public void readFromNBT(final NBTTagCompound data) {
super.readFromNBT(data);
this.duality.readFromNBT(data);
}
@Override
public void writeToNBT(final NBTTagCompound data) {
super.writeToNBT(data);
this.duality.writeToNBT(data);
}
@Override
public NBTTagCompound getMemoryCardData() {
final NBTTagCompound output = super.getMemoryCardData();
this.duality.getConfigManager().writeToNBT(output);
return output;
}
@Override
public void pasteMemoryCardData(PartP2PTunnel<?> newTunnel, NBTTagCompound data) throws GridAccessException {
this.duality.getConfigManager().readFromNBT(data);
super.pasteMemoryCardData(newTunnel, data);
}
@Override
public void addToWorld() {
super.addToWorld();
this.duality.initialize();
}
@Override
public void getDrops(final List<ItemStack> drops, final boolean wrenched) {
this.duality.addDrops(drops);
}
@Override
public int cableConnectionRenderTo() {
return 4;
}
@Override
public IConfigManager getConfigManager() {
return this.duality.getConfigManager();
}
@Override
public IInventory getInventoryByName(final String name) {
return this.duality.getInventoryByName(name);
}
@Override
public void onNeighborChanged() {
this.duality.updateRedstoneState();
}
@Override
public boolean onPartActivate(final EntityPlayer p, final Vec3 pos) {
AppEngInternalInventory patterns = this.duality.getPatterns();
public boolean onPartActivate(final EntityPlayer player, final Vec3 pos) {
AppEngInternalInventory patterns = (AppEngInternalInventory) this.duality.getPatterns();
final boolean wasActive = getProxy().isActive();
if (super.onPartActivate(p, pos)) {
if (!isOutput()) {
final ItemStack is = player.inventory.getCurrentItem();
if (is != null && is.getItem() instanceof IMemoryCard mc) {
if (ForgeEventFactory.onItemUseStart(player, is, 1) <= 0) return false;
try {
for (PartFluidP2PInterface p2p : getOutputs()) {
p2p.duality.setStorage(new AppEngInternalInventory(this, NUMBER_OF_STORAGE_SLOTS));
p2p.duality.setSlotInv(new WrapperInvSlot(duality.getStorage()));
p2p.duality.sharedInventory = false;
}
} catch (GridAccessException ignored) {}
}
}
if (super.onPartActivate(player, pos)) {
ArrayList<ItemStack> drops = new ArrayList<>();
for (int i = 0; i < patterns.getSizeInventory(); i++) {
if (patterns.getStackInSlot(i) == null) continue;
drops.add(patterns.getStackInSlot(i));
}
if (!duality.sharedInventory && !wasActive) {
AppEngInternalInventory storageAppEng = this.duality.getStorage();
for (int i = 0; i < NUMBER_OF_STORAGE_SLOTS; i++) {
if (storageAppEng.getStackInSlot(i) == null) continue;
drops.add(storageAppEng.getStackInSlot(i));
}
}
final IPart tile = this.getHost().getPart(this.getSide());
if (tile instanceof PartFluidP2PInterface dualTile) {
DualityInterface newDuality = dualTile.duality;
@@ -362,8 +299,8 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
}
if (!duality.sharedInventory) {
IInventory storage = duality.getStorage();
IInventory newStorage = newDuality.getStorage();
IInventory storage = (IInventory) duality.getStorage();
IInventory newStorage = (IInventory) newDuality.getStorage();
for (int i = 0; i < storage.getSizeInventory(); ++i) {
newStorage.setInventorySlotContents(i, storage.getStackInSlot(i));
}
@@ -379,13 +316,13 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
return true;
}
if (p.isSneaking()) {
if (player.isSneaking()) {
return false;
}
if (Platform.isServer()) {
InventoryHandler.openGui(
p,
player,
this.getHost().getTile().getWorldObj(),
new BlockPos(this.getHost().getTile()),
Objects.requireNonNull(this.getSide()),
@@ -396,23 +333,13 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
}
@Override
public IIcon getBreakingTexture() {
return this.getItemStack().getIconIndex();
public IIcon getTypeTexture() {
return ItemAndBlockHolder.INTERFACE.getBlockTextureFromSide(0);
}
@Override
public boolean canInsert(final ItemStack stack) {
return this.duality.canInsert(stack);
}
@Override
public IMEMonitor<IAEItemStack> getItemInventory() {
return this.duality.getItemInventory();
}
@Override
public IMEMonitor<IAEFluidStack> getFluidInventory() {
return this.duality.getFluidInventory();
public IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src) {
return duality.getMonitorable(side, src, this);
}
@Override
@@ -438,213 +365,139 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
}
@Override
public int getSizeInventory() {
return this.duality.getStorage().getSizeInventory();
public int getInstalledUpgrades(Upgrades u) {
return duality.getInstalledUpgrades(u);
}
@Override
public ItemStack getStackInSlot(final int i) {
return this.duality.getStorage().getStackInSlot(i);
public IMEMonitor<IAEItemStack> getItemInventory() {
return duality.getItemInventory();
}
@Override
public ItemStack decrStackSize(final int i, final int j) {
return this.duality.getStorage().decrStackSize(i, j);
}
@Override
public ItemStack getStackInSlotOnClosing(final int i) {
return this.duality.getStorage().getStackInSlotOnClosing(i);
}
@Override
public void setInventorySlotContents(final int i, final ItemStack itemstack) {
this.duality.getStorage().setInventorySlotContents(i, itemstack);
}
@Override
public String getInventoryName() {
return this.duality.getStorage().getInventoryName();
}
@Override
public boolean hasCustomInventoryName() {
return this.duality.getStorage().hasCustomInventoryName();
}
@Override
public int getInventoryStackLimit() {
return this.duality.getStorage().getInventoryStackLimit();
}
@Override
public void markDirty() {
this.duality.getStorage().markDirty();
}
@Override
public boolean isUseableByPlayer(final EntityPlayer entityplayer) {
return this.duality.getStorage().isUseableByPlayer(entityplayer);
}
@Override
public void openInventory() {
this.duality.getStorage().openInventory();
}
@Override
public void closeInventory() {
this.duality.getStorage().closeInventory();
}
@Override
public boolean isItemValidForSlot(final int i, final ItemStack itemstack) {
return this.duality.getStorage().isItemValidForSlot(i, itemstack);
}
@Override
public int[] getAccessibleSlotsFromSide(final int s) {
return this.duality.getAccessibleSlotsFromSide(s);
}
@Override
public boolean canInsertItem(final int i, final ItemStack itemstack, final int j) {
return true;
}
@Override
public boolean canExtractItem(final int i, final ItemStack itemstack, final int j) {
return true;
}
@Override
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc,
final ItemStack removedStack, final ItemStack newStack) {
this.duality.onChangeInventory(inv, slot, mc, removedStack, newStack);
}
@Override
public DualityInterface getInterfaceDuality() {
return this.duality;
}
@Override
public EnumSet<ForgeDirection> getTargets() {
return EnumSet.of(this.getSide());
}
@Override
public TileEntity getTileEntity() {
return super.getHost().getTile();
}
@Override
public IStorageMonitorable getMonitorable(final ForgeDirection side, final BaseActionSource src) {
return this.duality.getMonitorable(side, src, this);
}
@Override
public boolean pushPattern(final ICraftingPatternDetails patternDetails, final InventoryCrafting table) {
return this.duality.pushPattern(patternDetails, table);
}
@Override
public boolean isBusy() {
return this.duality.isBusy();
}
@Override
public void provideCrafting(final ICraftingProviderHelper craftingTracker) {
this.duality.provideCrafting(craftingTracker);
}
@Override
public ImmutableSet<ICraftingLink> getRequestedJobs() {
return this.duality.getRequestedJobs();
}
@Override
public IAEItemStack injectCraftedItems(final ICraftingLink link, final IAEItemStack items, final Actionable mode) {
return this.duality.injectCraftedItems(link, items, mode);
}
@Override
public void jobStateChange(final ICraftingLink link) {
this.duality.jobStateChange(link);
public IMEMonitor<IAEFluidStack> getFluidInventory() {
return duality.getFluidInventory();
}
@Override
public int getPriority() {
return this.duality.getPriority();
return duality.getPriority();
}
@Override
public void setPriority(final int newValue) {
this.duality.setPriority(newValue);
public void setPriority(int newValue) {
duality.setPriority(newValue);
}
@Override
public void onTunnelNetworkChange() {
this.duality.updateCraftingList();
updateSharingInventory();
duality.updateCraftingList();
}
@Override
public void onTunnelConfigChange() {
updateSharingInventory();
public void onChangeInventory(IInventory inv, int slot, InvOperation op, ItemStack removedStack,
ItemStack newStack) {
duality.onChangeInventory(inv, slot, op, removedStack, newStack);
}
@Override
public IInventory getPatterns() {
if (isOutput()) {
PartFluidP2PInterface input = getInput();
if (input != null) {
return input.getPatterns();
}
return IInterfaceHost.super.getPatterns();
}
return IInterfaceHost.super.getPatterns();
public boolean canInsert(ItemStack stack) {
return duality.canInsert(stack);
}
@Override
public int rows() {
if (isOutput()) {
PartFluidP2PInterface input = getInput();
if (input != null) {
return input.rows();
}
return IInterfaceHost.super.rows();
}
return IInterfaceHost.super.rows();
public int getSizeInventory() {
return duality.getStorage().getSizeInventory();
}
@Override
public int rowSize() {
if (isOutput()) {
PartFluidP2PInterface input = getInput();
if (input != null) {
return input.rowSize();
}
return IInterfaceHost.super.rowSize();
}
return IInterfaceHost.super.rowSize();
public ItemStack getStackInSlot(final int i) {
return duality.getStorage().getStackInSlot(i);
}
@Override
public String getName() {
if (isOutput()) {
PartFluidP2PInterface input = getInput();
if (input != null) {
return input.getName();
}
return IInterfaceHost.super.getName();
}
return IInterfaceHost.super.getName();
public ItemStack decrStackSize(int index, int count) {
return duality.getStorage().decrStackSize(index, count);
}
@Override
public ItemStack getSelfRep() {
return this.getItemStack();
public ItemStack getStackInSlotOnClosing(int index) {
return duality.getStorage().getStackInSlotOnClosing(index);
}
@Override
public void setInventorySlotContents(int index, ItemStack stack) {
duality.getStorage().setInventorySlotContents(index, stack);
}
@Override
public IInventory getInventoryByName(String name) {
return duality.getInventoryByName(name);
}
@Override
public IConfigManager getConfigManager() {
return duality.getConfigManager();
}
@Override
public IIcon getBreakingTexture() {
return getItemStack().getIconIndex();
}
@Override
public String getInventoryName() {
return duality.getStorage().getInventoryName();
}
@Override
public boolean hasCustomInventoryName() {
return duality.getStorage().hasCustomInventoryName();
}
@Override
public int getInventoryStackLimit() {
return duality.getStorage().getInventoryStackLimit();
}
@Override
public void markDirty() {
duality.markDirty();
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
return duality.getStorage().isUseableByPlayer(player);
}
@Override
public void openInventory() {
duality.getStorage().openInventory();
}
@Override
public void closeInventory() {
duality.getStorage().closeInventory();
}
@Override
public boolean isItemValidForSlot(int index, ItemStack stack) {
return duality.getStorage().isItemValidForSlot(index, stack);
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return duality.getAccessibleSlotsFromSide(side);
}
@Override
public boolean canInsertItem(int p_102007_1_, ItemStack itemStack, int p_102007_3_) {
return true;
}
@Override
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
return true;
}
@Override
@@ -717,9 +570,138 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
}
}
@Override
public DualityInterface getInterfaceDuality() {
return duality;
}
@Override
public EnumSet<ForgeDirection> getTargets() {
return EnumSet.of(this.getSide());
}
@Override
public TileEntity getTileEntity() {
return super.getHost().getTile();
}
@Override
public void provideCrafting(ICraftingProviderHelper craftingTracker) {
duality.provideCrafting(craftingTracker);
}
@Override
public boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table) {
return duality.pushPattern(patternDetails, table);
}
@Override
public boolean isBusy() {
return duality.isBusy();
}
@Override
public ImmutableSet<ICraftingLink> getRequestedJobs() {
return duality.getRequestedJobs();
}
@Override
public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode) {
return duality.injectCraftedItems(link, items, mode);
}
@Override
public void jobStateChange(ICraftingLink link) {
duality.jobStateChange(link);
}
@Override
public void readFromNBT(NBTTagCompound data) {
super.readFromNBT(data);
duality.readFromNBT(data);
}
@Override
public void writeToNBT(NBTTagCompound data) {
super.writeToNBT(data);
duality.writeToNBT(data);
}
@Override
public NBTTagCompound getMemoryCardData() {
final NBTTagCompound output = super.getMemoryCardData();
this.duality.getConfigManager().writeToNBT(output);
return output;
}
@Override
public void pasteMemoryCardData(PartP2PTunnel<?> newTunnel, NBTTagCompound data) throws GridAccessException {
this.duality.getConfigManager().readFromNBT(data);
super.pasteMemoryCardData(newTunnel, data);
}
@Override
public void addToWorld() {
super.addToWorld();
this.duality.initialize();
}
@Override
public void getDrops(List<ItemStack> drops, boolean wrenched) {
super.getDrops(drops, wrenched);
duality.addDrops(drops);
}
@Override
public boolean shouldDisplay() {
return IInterfaceHost.super.shouldDisplay();
}
@Override
public IInventory getPatterns() {
if (isOutput()) {
PartFluidP2PInterface input = getInput();
if (input != null) {
return input.getPatterns();
}
return IInterfaceHost.super.getPatterns();
}
return IInterfaceHost.super.getPatterns();
}
@Override
public int rows() {
if (isOutput()) {
PartFluidP2PInterface input = getInput();
if (input != null) {
return input.rows();
}
return IInterfaceHost.super.rows();
}
return IInterfaceHost.super.rows();
}
@Override
public int rowSize() {
if (isOutput()) {
PartFluidP2PInterface input = getInput();
if (input != null) {
return input.rowSize();
}
return IInterfaceHost.super.rowSize();
}
return IInterfaceHost.super.rowSize();
}
@Override
public String getName() {
if (isOutput()) {
PartFluidP2PInterface input = getInput();
if (input != null) {
return input.getName();
}
return IInterfaceHost.super.getName();
}
return IInterfaceHost.super.getName();
}
}
@@ -84,16 +84,15 @@ public class FluidCellInventory implements IFluidCellInventory {
}
final IInventory upgrades = this.getUpgradesInventory();
Upgrades u;
for (int x = 0; x < upgrades.getSizeInventory(); x++) {
final ItemStack is = upgrades.getStackInSlot(x);
if (is != null && is.getItem() instanceof IUpgradeModule) {
final Upgrades u = ((IUpgradeModule) is.getItem()).getType(is);
if (u != null) {
switch (u) {
case VOID_OVERFLOW -> cardVoidOverflow = true;
case DISTRIBUTION -> cardDistribution = true;
default -> {}
}
if (is == null) continue;
if (is.getItem() instanceof IUpgradeModule upgradeItem && (u = upgradeItem.getType(is)) != null) {
switch (u) {
case VOID_OVERFLOW -> cardVoidOverflow = true;
case DISTRIBUTION -> cardDistribution = true;
default -> {}
}
}
}
@@ -7,7 +7,6 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.Util;
import appeng.api.AEApi;
@@ -78,8 +77,8 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
@Override
public IFluidCellInventory getCellInv() {
Object o = this.getInternal();
if (o instanceof MEPassThrough) {
o = Ae2Reflect.getInternal((MEPassThrough<?>) o);
if (o instanceof MEPassThrough<?>pt) {
o = pt.getInternal();
}
return (IFluidCellInventory) (o instanceof IFluidCellInventory ? o : null);
}
@@ -87,16 +86,22 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
@Override
@SuppressWarnings("unchecked")
public Iterable<IAEFluidStack> getPartitionInv() {
return (Iterable<IAEFluidStack>) Ae2Reflect.getPartitionList(this).getItems();
return getPartitionList().getItems();
}
@Override
public boolean isPreformatted() {
return !Ae2Reflect.getPartitionList(this).isEmpty();
return !getPartitionList().isEmpty();
}
@Override
@Deprecated
public IncludeExclude getIncludeExcludeMode() {
return getWhitelist();
}
@Override
public IncludeExclude getWhitelist() {
return IncludeExclude.WHITELIST;
}
@@ -113,11 +118,7 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
@Override
public boolean canGetInv() {
IFluidCellInventory cellInv = this.getCellInv();
if (cellInv instanceof CreativeFluidCellInventory) {
return false;
} else {
return true;
}
return !(cellInv instanceof CreativeFluidCellInventory);
}
@Override
@@ -164,7 +165,6 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
IFluidCellInventory cellInventory = this.getCellInv();
if (cellInventory instanceof FluidCellInventory ci) {
return ci.getRestriction();
}
return null;
}
@@ -11,5 +11,9 @@ public interface IFluidCellInventoryHandler {
boolean isPreformatted();
/** use {@link IFluidCellInventoryHandler#getWhitelist} instead */
@Deprecated
IncludeExclude getIncludeExcludeMode();
IncludeExclude getWhitelist();
}
@@ -282,10 +282,9 @@ public class TileFluidAutoFiller extends AENetworkInvTile
if (!initialized) { // run postEvent on AE network is ready
initialized = true;
postEvent();
if (this.returnStack == null) return TickRateModulation.SLEEP;
}
if (this.returnStack == null) return TickRateModulation.SLEEP;
if (this.getStorageGrid() == null) {
return TickRateModulation.SLOWER;
}
@@ -59,6 +59,7 @@ import appeng.tile.events.TileEventType;
import appeng.tile.grid.AENetworkTile;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.SettingsFrom;
import appeng.util.item.AEItemStack;
import io.netty.buffer.ByteBuf;
@@ -101,10 +102,7 @@ public class TileLevelMaintainer extends AENetworkTile
@Override
public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode) {
int idx = this.getRequestIndexByLink(link);
if (idx == -1) {
AELog.warn("Invalid crafting link: " + link);
return items;
}
try {
if (getProxy().isActive()) {
final IEnergyGrid energy = getProxy().getEnergy();
@@ -116,7 +114,9 @@ public class TileLevelMaintainer extends AENetworkTile
.injectItems(ItemFluidDrop.getAeFluidStack(items), mode, source);
if (notInjectedItems != null) {
items.setStackSize(notInjectedItems.getStackSize());
this.updateState(idx, LevelState.Export);
if (idx != -1) {
this.updateState(idx, LevelState.Export);
}
return items;
} else {
@@ -430,7 +430,7 @@ public class TileLevelMaintainer extends AENetworkTile
NBTTagList tagList = new NBTTagList();
for (int i = 0; i < REQ_COUNT; i++) {
if (this.requests[i] != null) {
tagList.appendTag(this.requests[i].writeToNBT());
tagList.appendTag(this.requests[i].writeToNBT(true));
} else {
tagList.appendTag(new NBTTagCompound());
}
@@ -544,6 +544,42 @@ public class TileLevelMaintainer extends AENetworkTile
data.writeBoolean(isActive());
}
@Override
public void uploadSettings(SettingsFrom from, NBTTagCompound compound) {
super.uploadSettings(from, compound);
NBTTagList tagList = compound.getTagList(NBT_REQUESTS, Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound tag = tagList.getCompoundTagAt(i);
if (tag == null || !tag.hasKey(NBT_STACK)) {
this.requests[i] = null;
} else {
try {
this.requests[i] = new RequestInfo(tag, this);
this.requests[i].state = LevelState.None;
} catch (Exception ignored) {
this.requests[i] = null;
}
}
}
this.saveChanges();
}
@Override
public NBTTagCompound downloadSettings(SettingsFrom from) {
NBTTagCompound compound = super.downloadSettings(from);
compound = compound == null ? new NBTTagCompound() : compound;
NBTTagList tagList = new NBTTagList();
for (int i = 0; i < REQ_COUNT; i++) {
if (this.requests[i] != null) {
tagList.appendTag(this.requests[i].writeToNBT(false));
} else {
tagList.appendTag(new NBTTagCompound());
}
}
compound.setTag(NBT_REQUESTS, tagList);
return compound;
}
@MENetworkEventSubscribe
public void stateChange(final MENetworkPowerStatusChange p) {
updatePowerState();
@@ -643,7 +679,7 @@ public class TileLevelMaintainer extends AENetworkTile
}
}
public NBTTagCompound writeToNBT() {
public NBTTagCompound writeToNBT(boolean includeLink) {
NBTTagCompound tag = new NBTTagCompound();
NBTTagCompound stackTag = new NBTTagCompound();
itemStack.writeToNBT(stackTag);
@@ -652,7 +688,7 @@ public class TileLevelMaintainer extends AENetworkTile
tag.setLong(NBT_BATCH, batchSize);
tag.setBoolean(NBT_ENABLE, enable);
tag.setInteger(NBT_STATE, state.ordinal());
if (this.link != null) {
if (this.link != null && includeLink) {
NBTTagCompound linkTag = new NBTTagCompound();
this.link.writeToNBT(linkTag);
tag.setTag(NBT_LINK, linkTag);
@@ -23,6 +23,7 @@ import com.glodblock.github.util.Ae2Reflect;
import appeng.api.config.Actionable;
import appeng.api.networking.IGrid;
import appeng.api.networking.security.MachineSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
@@ -102,7 +103,7 @@ public class CoreModHooks {
}
public static void storeFluidItem(CraftingCPUCluster instance) {
final IGrid g = Ae2Reflect.getGrid(instance);
final IGrid g = instance.getGrid();
if (g == null) {
return;
@@ -111,28 +112,28 @@ public class CoreModHooks {
final IStorageGrid sg = g.getCache(IStorageGrid.class);
final IMEInventory<IAEItemStack> ii = sg.getItemInventory();
final IMEInventory<IAEFluidStack> jj = sg.getFluidInventory();
final MECraftingInventory inventory = Ae2Reflect.getCPUInventory(instance);
final MECraftingInventory inventory = (MECraftingInventory) instance.getInventory();
for (IAEItemStack is : inventory.getItemList()) {
is = inventory.extractItems(is.copy(), Actionable.MODULATE, Ae2Reflect.getCPUSource(instance));
is = inventory.extractItems(is.copy(), Actionable.MODULATE, instance.getActionSource());
if (is != null) {
Ae2Reflect.postCPUChange(instance, is, Ae2Reflect.getCPUSource(instance));
Ae2Reflect.postCPUChange(instance, is, (MachineSource) instance.getActionSource());
if (is.getItem() instanceof ItemFluidDrop) {
IAEFluidStack fluidDrop = ItemFluidDrop.getAeFluidStack(is);
fluidDrop = jj.injectItems(fluidDrop, Actionable.MODULATE, Ae2Reflect.getCPUSource(instance));
fluidDrop = jj.injectItems(fluidDrop, Actionable.MODULATE, instance.getActionSource());
if (fluidDrop == null) {
is = null;
} else {
is.setStackSize(fluidDrop.getStackSize());
}
} else {
is = ii.injectItems(is, Actionable.MODULATE, Ae2Reflect.getCPUSource(instance));
is = ii.injectItems(is, Actionable.MODULATE, instance.getActionSource());
}
}
if (is != null) {
inventory.injectItems(is, Actionable.MODULATE, Ae2Reflect.getCPUSource(instance));
inventory.injectItems(is, Actionable.MODULATE, instance.getActionSource());
}
}
@@ -140,7 +141,7 @@ public class CoreModHooks {
Ae2Reflect.setCPUInventory(instance, new MECraftingInventory());
}
Ae2Reflect.markCPUDirty(instance);
instance.markDirty();;
}
public static ItemStack getStackUnderMouse(GuiContainer gui, int mousex, int mousey) {
@@ -24,7 +24,6 @@ import com.glodblock.github.common.parts.PartFluidExportBus;
import com.glodblock.github.common.parts.PartFluidInterface;
import com.glodblock.github.common.parts.PartFluidP2PInterface;
import com.glodblock.github.common.tile.TileFluidInterface;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.Util;
@@ -428,7 +427,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
checkedInput = true;
}
if (p2p == invFluidsP2P || p2p == null) continue;
IFluidHandler target = Ae2Reflect.getP2PLiquidTarget(p2p);
IFluidHandler target = p2p.getTarget();
if (target == null) continue;
FluidTankInfo[] info = target.getTankInfo(p2p.getSide().getOpposite());
if (info != null) {
@@ -493,8 +492,8 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
DualityInterface other = target.getInterfaceDuality();
DualityInterface self = this.selfInterface.getInterfaceDuality();
try {
AENetworkProxy proxy1 = Ae2Reflect.getInterfaceProxy(other);
AENetworkProxy proxy2 = Ae2Reflect.getInterfaceProxy(self);
AENetworkProxy proxy1 = other.getProxy();
AENetworkProxy proxy2 = self.getProxy();
if (proxy1.getGrid() == proxy2.getGrid()) {
return false;
}
@@ -528,7 +527,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
ItemSlot slot = new ItemSlot();
slot.setSlot(nextSlotIndex++);
slot.setItemStack(fluid != null ? ItemFluidPacket.newStack(fluid) : null);
Ae2Reflect.setItemSlotExtractable(slot, false);
slot.setExtractable(false);
return slot;
} else {
ItemSlot slot = itemSlots.next();
@@ -13,6 +13,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import com.glodblock.github.inventory.ItemBiggerAppEngInventory;
@@ -209,11 +210,19 @@ public class WirelessMagnetCardFilterInventory extends BaseWirelessInventory imp
return null;
}
public boolean doInject(IAEItemStack is, EntityItem itemToGet) {
public boolean doInject(IAEItemStack is, EntityItem itemToGet, World world) {
IAEItemStack ais = (IAEItemStack) injectItems(is);
if (ais == null) return true;
itemToGet.getEntityItem().stackSize = (int) ais.getStackSize();
return false;
if (ais != null) {
player.onItemPickup(itemToGet, ais.getItemStack().stackSize);
player.inventory.addItemStackToInventory(ais.getItemStack());
world.playSoundAtEntity(
player,
"random.pop",
0.15F,
((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
return false;
}
return true;
}
public boolean isItemFiltered(ItemStack inputItemStack) {
@@ -43,7 +43,7 @@ public class CPacketInventoryAction implements IMessage {
public CPacketInventoryAction() {}
public CPacketInventoryAction(final InventoryAction action, final int slot, final long id) {
public CPacketInventoryAction(final InventoryAction action, final int slot, final int id) {
this.action = action;
this.slot = slot;
this.id = id;
@@ -51,7 +51,7 @@ public class CPacketInventoryAction implements IMessage {
this.isEmpty = true;
}
public CPacketInventoryAction(final InventoryAction action, final int slot, final long id, IAEItemStack stack) {
public CPacketInventoryAction(final InventoryAction action, final int slot, final int id, IAEItemStack stack) {
this.action = action;
this.slot = slot;
this.id = id;
@@ -123,9 +123,6 @@ public class CPacketInventoryAction implements IMessage {
if (baseContainer.getTargetStack() != null) {
cca.getCraftingItem().putStack(baseContainer.getTargetStack().getItemStack());
cca.setItemToCraft(baseContainer.getTargetStack());
if (message.id > 0) {
cca.setInitialCraftAmount(message.id);
}
}
cca.detectAndSendChanges();
}
@@ -70,7 +70,10 @@ public class CommonProxy {
.getFilter(wirelessTerm, result.getLeft(), gridNode, player);
if (inv.isPassFilter(stack)) {
if (inv.doInject(AEApi.instance().storage().createItemStack(stack), itemEntity)) {
if (inv.doInject(
AEApi.instance().storage().createItemStack(stack),
itemEntity,
world)) {
itemEntity.setDead();
e.setCanceled(true);
}
@@ -116,14 +116,17 @@ public class Ae2Reflect {
}
}
@Deprecated
public static IPartitionList<?> getPartitionList(MEInventoryHandler<?> me) {
return Ae2Reflect.readField(me, fAEInv_partitionList);
}
@Deprecated
public static IMEInventory<?> getInternal(MEPassThrough<?> me) {
return Ae2Reflect.readField(me, fAEPass_internal);
}
@Deprecated
public static void setItemSlotExtractable(ItemSlot slot, boolean extractable) {
try {
mItemSlot_setExtractable.invoke(slot, extractable);
@@ -132,26 +135,32 @@ public class Ae2Reflect {
}
}
@Deprecated
public static ICraftingCPU getCPU(CraftingCPURecord cpu) {
return Ae2Reflect.readField(cpu, fCPU_cpu);
}
@Deprecated
public static String getName(CraftingCPURecord cpu) {
return Ae2Reflect.readField(cpu, fCPU_myName);
}
@Deprecated
public static int getProcessors(CraftingCPURecord cpu) {
return Ae2Reflect.readField(cpu, fCPU_processors);
}
@Deprecated
public static long getSize(CraftingCPURecord cpu) {
return Ae2Reflect.readField(cpu, fCPU_size);
}
@Deprecated
public static IUpgradeableHost getUpgradeList(ContainerUpgradeable container) {
return Ae2Reflect.readField(container, fInventory_containerUpgrade);
}
@Deprecated
public static IGrid getGrid(CraftingCPUCluster cpu) {
try {
return (IGrid) mCPU_getGrid.invoke(cpu);
@@ -160,6 +169,7 @@ public class Ae2Reflect {
}
}
@Deprecated
public static IGrid getGrid(ContainerCraftConfirm ccc) {
try {
return (IGrid) mCraftConfirm_getGrid.invoke(ccc);
@@ -168,10 +178,12 @@ public class Ae2Reflect {
}
}
@Deprecated
public static ICraftingJob getResult(ContainerCraftConfirm ccc) {
return Ae2Reflect.readField(ccc, fCraftConfirm_result);
}
@Deprecated
public static MECraftingInventory getCPUInventory(CraftingCPUCluster cpu) {
return Ae2Reflect.readField(cpu, fCPU_inventory);
}
@@ -180,14 +192,17 @@ public class Ae2Reflect {
Ae2Reflect.writeField(cpu, fCPU_inventory, value);
}
@Deprecated
public static MachineSource getCPUSource(CraftingCPUCluster cpu) {
return Ae2Reflect.readField(cpu, fCPU_machineSrc);
}
@Deprecated
public static IUpgradeableHost getUpgradeableHost(ContainerUpgradeable owner) {
return Ae2Reflect.readField(owner, fContainerUpgradeable_upgradeable);
}
@Deprecated
public static AENetworkProxy getInterfaceProxy(DualityInterface owner) {
return Ae2Reflect.readField(owner, fDualInterface_gridProxy);
}
@@ -200,6 +215,7 @@ public class Ae2Reflect {
}
}
@Deprecated
public static void markCPUDirty(CraftingCPUCluster cpu) {
try {
mCPU_markDirty.invoke(cpu);
@@ -208,6 +224,7 @@ public class Ae2Reflect {
}
}
@Deprecated
public static IFluidHandler getP2PLiquidTarget(PartP2PLiquids p2p) {
try {
return (IFluidHandler) mP2PLiquids_getTarget.invoke(p2p);
@@ -45,18 +45,22 @@ public class Ae2ReflectClient {
}
}
@Deprecated
public static void rewriteIcon(GuiCraftingStatus gui, ItemStack icon) {
Ae2Reflect.writeField(gui, fGuiCPUStatus_icon, icon);
}
@Deprecated
public static Set<Slot> getDragClick(AEBaseGui gui) {
return Ae2Reflect.readField(gui, fGui_drag);
}
@Deprecated
public static AppEngRenderItem getStackSizeRenderer(AEBaseGui gui) {
return Ae2Reflect.readField(gui, fAEBaseGui_stackSizeRenderer);
}
@Deprecated
public static GuiTabButton getOriginalGuiButton(GuiCraftingStatus gui) {
return Ae2Reflect.readField(gui, fGuiCraftingStatus_originalGuiBtn);
}
@@ -281,28 +281,28 @@ public final class Util {
}
public static FluidStack getFluidFromItem(ItemStack stack) {
if (stack != null) {
FluidStack fluid = null;
if (stack == null) return null;
if (stack.getItem() instanceof IFluidContainerItem) {
fluid = ((IFluidContainerItem) stack.getItem()).getFluid(stack);
} else if (FluidContainerRegistry.isContainer(stack)) {
fluid = FluidContainerRegistry.getFluidForFilledItem(stack);
} else if (stack.getItem() instanceof ItemFluidPacket) {
fluid = ItemFluidPacket.getFluidStack(stack);
} else if (stack.getItem() instanceof ItemFluidDrop) {
fluid = ItemFluidDrop.getFluidStack(Util.copyStackWithSize(stack, 1));
}
FluidStack fluid = null;
if (fluid == null) {
fluid = StackInfo.getFluid(Util.copyStackWithSize(stack, 1));
}
if (stack.getItem() instanceof IFluidContainerItem) {
fluid = ((IFluidContainerItem) stack.getItem()).getFluid(stack);
} else if (FluidContainerRegistry.isContainer(stack)) {
fluid = FluidContainerRegistry.getFluidForFilledItem(stack);
} else if (stack.getItem() instanceof ItemFluidPacket) {
fluid = ItemFluidPacket.getFluidStack(stack);
} else if (stack.getItem() instanceof ItemFluidDrop) {
fluid = ItemFluidDrop.getFluidStack(Util.copyStackWithSize(stack, 1));
}
if (fluid != null) {
FluidStack fluid0 = fluid.copy();
fluid0.amount *= stack.stackSize;
return fluid0;
}
if (fluid == null) {
fluid = StackInfo.getFluid(Util.copyStackWithSize(stack, 1));
}
if (fluid != null) {
FluidStack fluid0 = fluid.copy();
fluid0.amount *= stack.stackSize;
return fluid0;
}
return null;
}