add wireless fluid pattern terminal

This commit is contained in:
asdflj committed 2023-01-31 15:50:45 +08:00
1 parent a22814940b
commit 7f53e01184
25 files changed
+708 -91

No files matched your search

@@ -13,7 +13,8 @@ import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartFluidTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.WirelessTerminal;
import com.glodblock.github.inventory.item.WirelessFluidTerminal;
import com.glodblock.github.inventory.item.WirelessPatternTerminal;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.Ae2ReflectClient;
@@ -35,8 +36,10 @@ public class GuiFluidPatternTerminalCraftingStatus extends GuiCraftingStatus {
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL_EX, 1));
else if (host instanceof PartFluidTerminal) {
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.FLUID_TERM, 1));
} else if (host instanceof WirelessTerminal) {
} else if (host instanceof WirelessFluidTerminal) {
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.WIRELESS_FLUID_TERM, 1));
} else if (host instanceof WirelessPatternTerminal) {
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.WIRELESS_PATTERN_TERM, 1));
}
super.initGui();
@@ -50,7 +53,9 @@ public class GuiFluidPatternTerminalCraftingStatus extends GuiCraftingStatus {
else if (host instanceof PartFluidPatternTerminalEx)
InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL_EX);
else if (host instanceof PartFluidTerminal) InventoryHandler.switchGui(GuiType.FLUID_TERMINAL);
else if (host instanceof WirelessTerminal) InventoryHandler.switchGui(GuiType.WIRELESS_FLUID_TERMINAL);
else if (host instanceof WirelessFluidTerminal) InventoryHandler.switchGui(GuiType.WIRELESS_FLUID_TERMINAL);
else if (host instanceof WirelessPatternTerminal)
InventoryHandler.switchGui(GuiType.WIRELESS_FLUID_PATTERN_TERMINAL);
} else {
super.actionPerformed(btn);
}
@@ -0,0 +1,12 @@
package com.glodblock.github.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.inventory.item.IWirelessTerminal;
public class GuiPatternPortableCell extends GuiFluidPatternTerminal {
public GuiPatternPortableCell(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
super(inventoryPlayer, te);
}
}
@@ -0,0 +1,69 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.util.Platform;
import com.glodblock.github.inventory.item.IWirelessTerminal;
public class ContainerPatternPortableCell extends ContainerFluidPatternTerminal {
private double powerMultiplier = 0.5;
private final IWirelessTerminal civ;
private int ticks = 0;
private final int slot;
public ContainerPatternPortableCell(InventoryPlayer ip, IWirelessTerminal monitorable) {
super(ip, monitorable);
if (monitorable != null) {
final int slotIndex = monitorable.getInventorySlot();
this.lockPlayerInventorySlot(slotIndex);
this.slot = slotIndex;
} else {
this.slot = -1;
this.lockPlayerInventorySlot(ip.currentItem);
}
this.civ = monitorable;
}
public void detectAndSendChanges() {
final ItemStack currentItem = this.slot < 0 ? this.getPlayerInv().getCurrentItem()
: this.getPlayerInv().getStackInSlot(this.slot);
if (this.civ != null) {
if (currentItem != this.civ.getItemStack()) {
if (currentItem != null) {
if (Platform.isSameItem(this.civ.getItemStack(), currentItem)) {
this.getPlayerInv()
.setInventorySlotContents(this.getPlayerInv().currentItem, this.civ.getItemStack());
} else {
this.setValidContainer(false);
}
} else {
this.setValidContainer(false);
}
}
} else {
this.setValidContainer(false);
}
this.ticks++;
if (this.ticks > 10 && this.civ != null) {
this.civ.extractAEPower(
this.getPowerMultiplier() * this.ticks,
Actionable.MODULATE,
PowerMultiplier.CONFIG);
this.ticks = 0;
}
super.detectAndSendChanges();
}
private double getPowerMultiplier() {
return this.powerMultiplier;
}
void setPowerMultiplier(final double powerMultiplier) {
this.powerMultiplier = powerMultiplier;
}
}
@@ -36,8 +36,8 @@ import com.glodblock.github.client.gui.container.ContainerItemMonitor;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.parts.base.FCFluidEncodeTerminal;
import com.glodblock.github.inventory.IPatternConsumer;
import com.glodblock.github.inventory.item.PatternTerminal;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.FluidPatternDetails;
import com.glodblock.github.util.Util;
@@ -45,7 +45,7 @@ import com.glodblock.github.util.Util;
public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket, IPatternConsumer {
protected final FCFluidEncodeTerminal patternTerminal;
protected final PatternTerminal patternTerminal;
protected final AppEngInternalInventory cOut = new AppEngInternalInventory(null, 1);
protected final IInventory crafting;
protected final SlotRestrictedInput patternSlotIN;
@@ -77,7 +77,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
public FCContainerEncodeTerminal(final InventoryPlayer ip, final ITerminalHost monitorable) {
super(ip, monitorable);
this.patternTerminal = (FCFluidEncodeTerminal) monitorable;
this.patternTerminal = (PatternTerminal) monitorable;
this.inverted = patternTerminal.isInverted();
final IInventory patternInv = this.patternTerminal.getInventoryByName("pattern");
this.crafting = this.patternTerminal.getInventoryByName("crafting");
@@ -170,7 +170,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
}
}
public FCFluidEncodeTerminal getPatternTerminal() {
public PatternTerminal getPatternTerminal() {
return this.patternTerminal;
}
@@ -368,13 +368,11 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
for (final ItemStack encodedPatternStack : AEApi.instance().definitions().items().encodedPattern()
.maybeStack(1).asSet()) {
output = encodedPatternStack;
this.patternSlotOUT.putStack(output);
}
} else if (output.getItem() instanceof ItemFluidEncodedPattern) {
for (final ItemStack encodedPatternStack : AEApi.instance().definitions().items().encodedPattern()
.maybeStack(1).asSet()) {
output = encodedPatternStack;
this.patternSlotOUT.putStack(output);
}
}
@@ -399,6 +397,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
encodedValue.setBoolean("beSubstitute", this.beSubstitute);
encodedValue.setBoolean("prioritize", this.prioritize);
output.setTagCompound(encodedValue);
this.patternSlotOUT.putStack(output);
}
protected ItemStack[] getInputs() {