mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 18:44:42 +00:00
Merge remote-tracking branch 'Inphysible/p2pinterface-share-configandstorage-inventory' into dev
This commit is contained in:
3 files changed
+99
-2
No files matched your search
@@ -17,6 +17,7 @@ import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.config.AdvancedBlockingMode;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.InsertionMode;
|
||||
import appeng.api.config.LockCraftingMode;
|
||||
import appeng.api.config.Settings;
|
||||
@@ -43,6 +44,7 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
private GuiTabButton switcher;
|
||||
private GuiImgButton BlockMode;
|
||||
private GuiImgButton SmartBlockMode;
|
||||
private GuiImgButton fuzzyMode;
|
||||
private GuiToggleButton interfaceMode;
|
||||
private GuiImgButton insertionMode;
|
||||
private GuiImgButton sidelessMode;
|
||||
@@ -152,6 +154,16 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
LockCraftingMode.NONE);
|
||||
this.lockCraftingMode.visible = this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0;
|
||||
this.buttonList.add(lockCraftingMode);
|
||||
|
||||
offset += 18;
|
||||
|
||||
this.fuzzyMode = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + offset,
|
||||
Settings.FUZZY_MODE,
|
||||
FuzzyMode.IGNORE_ALL);
|
||||
this.fuzzyMode.visible = this.bc.getInstalledUpgrades(Upgrades.FUZZY) > 0;
|
||||
this.buttonList.add(fuzzyMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,6 +199,9 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
if (this.lockCraftingMode != null) {
|
||||
this.lockCraftingMode.set(((ContainerInterface) this.cvb).getLockCraftingMode());
|
||||
}
|
||||
if (this.fuzzyMode != null) {
|
||||
this.fuzzyMode.set(((ContainerInterface) this.cvb).getFuzzyMode());
|
||||
}
|
||||
this.fontRendererObj.drawString(
|
||||
getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)),
|
||||
8,
|
||||
@@ -198,7 +213,7 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
protected String getBackground() {
|
||||
if (!ModAndClassUtil.isBigInterface) return "guis/interface.png";
|
||||
return switch (((ContainerInterface) this.cvb).getPatternCapacityCardsInstalled()) {
|
||||
case -1 -> "guis/interfacenone.png";
|
||||
case -1 -> "guis/interfacenonenoconfig.png";
|
||||
case 1 -> "guis/interface2.png";
|
||||
case 2 -> "guis/interface3.png";
|
||||
case 3 -> "guis/interface4.png";
|
||||
@@ -240,6 +255,8 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
.sendToServer(new PacketConfigButton(this.advancedBlockingMode.getSetting(), backwards));
|
||||
} else if (btn == this.lockCraftingMode) {
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.lockCraftingMode.getSetting(), backwards));
|
||||
} else if (btn == this.fuzzyMode) {
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.fuzzyMode.getSetting(), backwards));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,5 +273,8 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
if (this.lockCraftingMode != null) {
|
||||
this.lockCraftingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0);
|
||||
}
|
||||
if (this.fuzzyMode != null) {
|
||||
this.fuzzyMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.FUZZY) > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,6 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
PartFluidP2PInterface p2p = getInput();
|
||||
if (p2p != null) {
|
||||
this.craftingList = p2p.duality.craftingList;
|
||||
|
||||
try {
|
||||
this.gridProxy.getGrid()
|
||||
.postEvent(new MENetworkCraftingPatternChange(this, this.gridProxy.getNode()));
|
||||
@@ -96,11 +95,86 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateStorage() {
|
||||
if (!isOutput()) {
|
||||
super.updateStorage();
|
||||
try {
|
||||
for (PartFluidP2PInterface p2p : getOutputs()) p2p.duality.updateStorage();
|
||||
} catch (GridAccessException e) {
|
||||
|
||||
}
|
||||
} else {
|
||||
PartFluidP2PInterface p2p = getInput();
|
||||
if ((p2p != null)) this.setStorage(p2p.duality.getStorage());
|
||||
this.readConfig();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readConfig() {
|
||||
if (!isOutput()) {
|
||||
super.readConfig();
|
||||
try {
|
||||
for (PartFluidP2PInterface p2p : getOutputs()) p2p.duality.readConfig();
|
||||
} catch (GridAccessException e) {
|
||||
|
||||
}
|
||||
} else {
|
||||
PartFluidP2PInterface p2p = getInput();
|
||||
this.setHasConfig(false);
|
||||
|
||||
if (p2p != null) {
|
||||
if (!p2p.duality.getConfig().isEmpty()) this.setHasConfig(p2p.duality.hasConfig());
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDrops(final List<ItemStack> drops) {
|
||||
if (!isOutput()) {
|
||||
super.addDrops(drops);
|
||||
try {
|
||||
for (PartFluidP2PInterface p2p : getOutputs()) p2p.duality.addDrops(drops);
|
||||
} catch (GridAccessException e) {
|
||||
|
||||
}
|
||||
} else {
|
||||
if (this.getWaitingToSend() != null) {
|
||||
for (final ItemStack is : this.getWaitingToSend()) {
|
||||
if (is != null) {
|
||||
drops.add(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (final ItemStack is : this.getUpgrades()) {
|
||||
if (is != null) {
|
||||
drops.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
for (final ItemStack is : this.getPatterns()) {
|
||||
if (is != null) {
|
||||
drops.add(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades(Upgrades u) {
|
||||
if (isOutput() && u == Upgrades.PATTERN_CAPACITY) return -1;
|
||||
return super.getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getConfigSize() {
|
||||
if (isOutput()) return -1;
|
||||
return super.getConfigSize();
|
||||
}
|
||||
};
|
||||
private final DualityFluidInterface dualityFluid = new DualityFluidInterface(this.getProxy(), this);
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 6);
|
||||
|
||||
@@ -120,6 +120,9 @@ public class CommonProxy {
|
||||
Upgrades.LOCK_CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 1);
|
||||
Upgrades.LOCK_CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 1);
|
||||
Upgrades.LOCK_CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE_P2P), 1);
|
||||
Upgrades.FUZZY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 3);
|
||||
Upgrades.FUZZY.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 3);
|
||||
Upgrades.FUZZY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE_P2P), 3);
|
||||
Upgrades.CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_STORAGE_BUS), 5);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_STORAGE_BUS), 1);
|
||||
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_STORAGE_BUS), 1);
|
||||
|
||||
Reference in new issue
Block a user