Add LevelMaintainer

This commit is contained in:
asdflj committed 2022-11-09 11:03:46 +08:00
1 parent 89068c4dff
commit 5d31d6d6fb
15 files changed
+373 -170

No files matched your search

@@ -130,7 +130,6 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
this.guiLeft + 84, this.guiTop + this.ySize - 153, Settings.ACTIONS, PatternBeSubstitution.DISABLED);
this.beSubstitutionsDisabledBtn.setHalfSize(true);
this.buttonList.add(this.beSubstitutionsDisabledBtn);
}
this.combineEnableBtn = new GuiFCImgButton(this.guiLeft + combineLeft, this.guiTop + this.ySize - combineTop, "FORCE_COMBINE", "DO_COMBINE");
this.combineEnableBtn.setHalfSize(true);
@@ -101,12 +101,12 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
this.substitutionsDisabledBtn.setHalfSize( true );
this.buttonList.add( this.substitutionsDisabledBtn );
this.fluidPrioritizedEnabledBtn = new GuiFCImgButton( this.guiLeft + 97, this.guiTop + this.ySize - 143, "FORCE_PRIO", "DO_PRIO" );
this.fluidPrioritizedEnabledBtn.setHalfSize( true );
this.fluidPrioritizedEnabledBtn = new GuiFCImgButton(this.guiLeft + 97, this.guiTop + this.ySize - 114, "FORCE_PRIO", "DO_PRIO");
this.fluidPrioritizedEnabledBtn.setHalfSize(true);
this.buttonList.add( this.fluidPrioritizedEnabledBtn );
this.fluidPrioritizedDisabledBtn = new GuiFCImgButton( this.guiLeft + 97, this.guiTop + this.ySize - 143, "NOT_PRIO", "DONT_PRIO" );
this.fluidPrioritizedDisabledBtn.setHalfSize( true );
this.fluidPrioritizedDisabledBtn = new GuiFCImgButton(this.guiLeft + 97, this.guiTop + this.ySize - 114, "NOT_PRIO", "DONT_PRIO");
this.fluidPrioritizedDisabledBtn.setHalfSize(true);
this.buttonList.add( this.fluidPrioritizedDisabledBtn );
invertBtn = new GuiImgButton( this.guiLeft + 87, this.guiTop + this.ySize - 153, Settings.ACTIONS, container.inverted ? PatternSlotConfig.C_4_16 : PatternSlotConfig.C_16_4);
@@ -126,21 +126,21 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
this.buttonList.add(this.doubleBtn);
}
this.combineEnableBtn = new GuiFCImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 143, "FORCE_COMBINE", "DO_COMBINE");
this.combineEnableBtn = new GuiFCImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 114, "FORCE_COMBINE", "DO_COMBINE");
this.combineEnableBtn.setHalfSize(true);
this.buttonList.add(this.combineEnableBtn);
this.combineDisableBtn = new GuiFCImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 143, "NOT_COMBINE", "DONT_COMBINE");
this.combineDisableBtn = new GuiFCImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 114, "NOT_COMBINE", "DONT_COMBINE");
this.combineDisableBtn.setHalfSize(true);
this.buttonList.add(this.combineDisableBtn);
if (ModAndClassUtil.isBeSubstitutionsButton) {
this.beSubstitutionsEnabledBtn = new GuiImgButton(
this.guiLeft + 87, this.guiTop + this.ySize - 133, Settings.ACTIONS, PatternBeSubstitution.ENABLED);
this.guiLeft + 87, this.guiTop + this.ySize - 103, Settings.ACTIONS, PatternBeSubstitution.ENABLED);
this.beSubstitutionsEnabledBtn.setHalfSize(true);
this.buttonList.add(this.beSubstitutionsEnabledBtn);
this.beSubstitutionsDisabledBtn = new GuiImgButton(
this.guiLeft + 87, this.guiTop + this.ySize - 133, Settings.ACTIONS, PatternBeSubstitution.DISABLED);
this.guiLeft + 87, this.guiTop + this.ySize - 103, Settings.ACTIONS, PatternBeSubstitution.DISABLED);
this.beSubstitutionsDisabledBtn.setHalfSize(true);
this.buttonList.add(this.beSubstitutionsDisabledBtn);
}
@@ -8,10 +8,7 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.client.gui.AEBaseMEGui;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.ISortSource;
import appeng.client.gui.widgets.*;
import appeng.client.me.InternalSlotME;
import appeng.client.me.SlotDisconnected;
import appeng.client.me.SlotME;
@@ -32,6 +29,8 @@ import appeng.integration.IntegrationType;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import codechicken.nei.LayoutManager;
import codechicken.nei.util.TextHistory;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.FCBaseFluidMonitorContain;
import com.glodblock.github.client.me.FluidRepo;
@@ -40,6 +39,7 @@ import com.glodblock.github.network.CPacketInventoryAction;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.resources.I18n;
@@ -52,9 +52,10 @@ import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.List;
public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, IConfigManagerHost {
public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, IConfigManagerHost, IDropToFillTextField {
public static int craftingGridOffsetX;
public static int craftingGridOffsetY;
@@ -309,11 +310,9 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
@Override
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
if (searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH) {
this.searchField.mouseClicked(xCoord, yCoord, btn);
}
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
setSearchString("", true);
}
@@ -321,6 +320,39 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
super.mouseClicked(xCoord, yCoord, btn);
}
@Override
public void handleMouseInput() {
final int wheel = Mouse.getEventDWheel();
final int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight;
if (wheel != 0 && this.searchField.isMouseIn(x, y) && isCtrlKeyDown()) {
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
if (searchMode == SearchBoxMode.NEI_MANUAL_SEARCH || searchMode == SearchBoxMode.NEI_AUTOSEARCH) {
try {
Field cls = LayoutManager.searchField.getClass().getDeclaredField("history");
cls.setAccessible(true);
TextHistory history = ((TextHistory) cls.get("get"));
TextHistory.Direction direction;
if (wheel > 0) {
direction = TextHistory.Direction.PREVIOUS;
} else {
direction = TextHistory.Direction.NEXT;
}
history.get(direction, this.searchField.getText())
.map(newText -> {
setSearchString(newText, true);
return true;
})
.orElse(false);
return;
} catch (NoSuchFieldException | IllegalAccessException e) {
}
}
}
super.handleMouseInput();
}
@Override
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
@@ -686,4 +718,15 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
return false;
}
@Override
public boolean isOverTextField(int mousex, int mousey) {
return searchField.isMouseIn(mousex, mousey);
}
@Override
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
if (Util.getFluidFromItem(stack) != null) {
setSearchString(Util.getFluidFromItem(stack).getFluid().getLocalizedName(), true);
}
}
}
@@ -7,10 +7,7 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.client.gui.AEBaseMEGui;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.ISortSource;
import appeng.client.gui.widgets.*;
import appeng.client.me.InternalSlotME;
import appeng.client.me.ItemRepo;
import appeng.client.me.SlotDisconnected;
@@ -32,6 +29,8 @@ import appeng.integration.IntegrationType;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import codechicken.nei.LayoutManager;
import codechicken.nei.util.TextHistory;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.FCBaseMonitorContain;
import com.glodblock.github.network.CPacketInventoryAction;
@@ -48,10 +47,10 @@ import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.List;
public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfigManagerHost
{
public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfigManagerHost, IDropToFillTextField {
public static int craftingGridOffsetX;
public static int craftingGridOffsetY;
@@ -343,29 +342,58 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
}
@Override
protected void mouseClicked( final int xCoord, final int yCoord, final int btn )
{
final Enum<?> searchMode = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
if( searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH )
{
this.searchField.mouseClicked( xCoord, yCoord, btn );
protected void mouseClicked( final int xCoord, final int yCoord, final int btn ) {
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
ItemStack is = player.inventory.getItemStack();
if (searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH) {
this.searchField.mouseClicked(xCoord, yCoord, btn);
}
if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
{
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
setSearchString("", true);
}
super.mouseClicked( xCoord, yCoord, btn );
super.mouseClicked(xCoord, yCoord, btn);
}
@Override
protected void handleMouseClick( final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton )
{
public void handleMouseInput() {
final int wheel = Mouse.getEventDWheel();
final int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight;
if (wheel != 0 && this.searchField.isMouseIn(x, y) && isCtrlKeyDown()) {
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
if (searchMode == SearchBoxMode.NEI_MANUAL_SEARCH || searchMode == SearchBoxMode.NEI_AUTOSEARCH) {
try {
Field cls = LayoutManager.searchField.getClass().getDeclaredField("history");
cls.setAccessible(true);
TextHistory history = ((TextHistory) cls.get("get"));
TextHistory.Direction direction;
if (wheel > 0) {
direction = TextHistory.Direction.PREVIOUS;
} else {
direction = TextHistory.Direction.NEXT;
}
history.get(direction, this.searchField.getText())
.map(newText -> {
setSearchString(newText, true);
return true;
})
.orElse(false);
return;
} catch (NoSuchFieldException | IllegalAccessException e) {
}
}
}
super.handleMouseInput();
}
@Override
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (mouseButton == 3 ){
if (mouseButton == 3) {
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
if (slot.getHasStack()) {
InventoryAction action = InventoryAction.valueOf("SET_PATTERN_VALUE");
@@ -790,4 +818,13 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
return false;
}
@Override
public boolean isOverTextField(int mousex, int mousey) {
return searchField.isMouseIn(mousex, mousey);
}
@Override
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
setSearchString(displayName, true);
}
}
@@ -4,9 +4,13 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.render.AppEngRenderItem;
import appeng.container.slot.SlotFake;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketNEIDragClick;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerLevelMaintainer;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.tile.TileLevelMaintainer;
import com.glodblock.github.inventory.gui.MouseRegionManager;
import com.glodblock.github.inventory.slot.SlotSingleItem;
@@ -14,16 +18,22 @@ import com.glodblock.github.network.CPacketLevelMaintainer;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.Optional;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import java.awt.*;
import java.util.Collections;
import java.util.List;
public class GuiLevelMaintainer extends AEBaseGui {
@Optional.Interface(modid = "NotEnoughItems", iface = "codechicken.nei.api.INEIGuiHandler")
public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/level_maintainer.png");
private final ContainerLevelMaintainer cont;
@@ -44,7 +54,7 @@ public class GuiLevelMaintainer extends AEBaseGui {
public void postUpdate(List<IAEItemStack> list) {
for (IAEItemStack is : list) {
long size = is.getItemStack().getTagCompound().getLong("BatchSize");
long size = is.getItemStack().getTagCompound().getLong("Batch");
int i = is.getItemStack().getTagCompound().getInteger("Index");
qtyInputs[i].textField.setText(String.valueOf(is.getStackSize()));
batchInputs[i].textField.setText(String.valueOf(size));
@@ -109,9 +119,10 @@ public class GuiLevelMaintainer extends AEBaseGui {
super.func_146977_a(new SlotSingleItem(slot));
if (stack == null) return true;
IAEItemStack fake = stack.copy();
if (fake.getItemStack().getItem() instanceof ItemFluidPacket) {
if (ItemFluidPacket.getFluidStack(stack) != null && ItemFluidPacket.getFluidStack(stack).amount > 0)
fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount);
if (this.qtyInputs[slot.getSlotIndex()].textField.getText().matches("[0-9]+")) {
fake.setStackSize(Long.parseLong(this.qtyInputs[slot.getSlotIndex()].textField.getText()));
} else {
fake.setStackSize(0);
}
stackSizeRenderer.setAeStack(fake);
stackSizeRenderer.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), stack.getItemStack(), slot.xDisplayPosition, slot.yDisplayPosition);
@@ -172,10 +183,11 @@ public class GuiLevelMaintainer extends AEBaseGui {
@Override
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
if (slot instanceof ContainerLevelMaintainer.FakeSlot && this.cont.getPlayerInv().getItemStack() != null) {
this.qtyInputs[slot.getSlotIndex()].textField.setText(String.valueOf(this.cont.getPlayerInv().getItemStack().stackSize));
return;
}
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
}
public void updateAmount(int idx, int stackSize) {
@@ -184,7 +196,8 @@ public class GuiLevelMaintainer extends AEBaseGui {
private boolean sendToServer(Widget widget) {
if (((ContainerLevelMaintainer.FakeSlot) cont.inventorySlots.get(widget.idx)).getHasStack()) {
if (!widget.textField.getText().isEmpty() && widget.textField.getText().matches("[0-9]+") && Long.parseLong(widget.textField.getText()) <= Integer.MAX_VALUE) {
if (!widget.textField.getText().isEmpty() && widget.textField.getText().matches("[0-9]+")) {
widget.textField.setText(widget.textField.getText().replaceAll("^(0+)", ""));
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(widget.action, widget.idx, widget.textField.getText()));
widget.textField.setTextColor(0xFFFFFF);
return true;
@@ -213,6 +226,49 @@ public class GuiLevelMaintainer extends AEBaseGui {
}
}
@Override
public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) {
return currentVisibility;
}
@Override
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
return Collections.emptyList();
}
@Override
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
return null;
}
private Rectangle getSlotArea(SlotFake slot) {
return new Rectangle(guiLeft + slot.getX(), guiTop + slot.getY(), 16, 16);
}
@Override
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
for (ContainerLevelMaintainer.FakeSlot slot : this.cont.getRequestSlots()) {
if (getSlotArea(slot).contains(mouseX, mouseY)) {
slot.putStack(draggedStack);
NetworkHandler.instance.sendToServer(new PacketNEIDragClick(draggedStack, slot.getSlotIndex()));
if (draggedStack != null) {
this.updateAmount(slot.getSlotIndex(), draggedStack.stackSize);
draggedStack.stackSize = 0;
}
return true;
}
}
if (draggedStack != null) {
draggedStack.stackSize = 0;
}
return false;
}
@Override
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
return false;
}
private class Widget {
public final int idx;
public final int action;
@@ -224,6 +280,7 @@ public class GuiLevelMaintainer extends AEBaseGui {
this.textField.setMessage(tooltip);
this.textField.setEnableBackgroundDrawing(false);
this.textField.setText("0");
this.textField.setMaxStringLength(10); // it's enough to useful
this.button = button;
this.idx = idx;
this.action = action;
@@ -1,34 +1,27 @@
package com.glodblock.github.client.gui.container;
import appeng.container.AEBaseContainer;
import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import com.glodblock.github.client.gui.GuiLevelMaintainer;
import com.glodblock.github.common.tile.TileLevelMaintainer;
import com.glodblock.github.inventory.AeItemStackHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerLevelMaintainer extends AEBaseContainer {
private final TileLevelMaintainer tile;
private final FakeSlot[] craftingSlots = new FakeSlot[TileLevelMaintainer.REQ_COUNT];
private final FakeSlot[] requestSlots = new FakeSlot[TileLevelMaintainer.REQ_COUNT];
public ContainerLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
super(ipl, tile);
this.tile = tile;
AeItemStackHandler crafting = new AeItemStackHandler(tile.getCraftingSlots());
AeItemStackHandler request = new AeItemStackHandler(tile.getRequestSlots());
for (int y = 0; y < TileLevelMaintainer.REQ_COUNT; y++) {
FakeSlot slot = new FakeSlot(crafting, y, 17, 19 + y * 20);
FakeSlot slot = new FakeSlot(request, y, 17, 19 + y * 20);
addSlotToContainer(slot);
craftingSlots[y] = slot;
requestSlots[y] = slot;
}
bindPlayerInventory(ipl, 0, 132);
}
@@ -37,15 +30,15 @@ public class ContainerLevelMaintainer extends AEBaseContainer {
return tile;
}
public FakeSlot[] getRequestSlots() {
return this.requestSlots;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int idx) {
for (ContainerFluidPatternEncoder.SlotFluidConvertingFake slot : craftingSlots) {
for (FakeSlot slot : this.getRequestSlots()) {
if (!slot.getHasStack()) {
slot.setAeStack(AEItemStack.create(((Slot) this.inventorySlots.get(idx)).getStack()), true);
if (Platform.isClient()) {
GuiLevelMaintainer gui = (GuiLevelMaintainer) Minecraft.getMinecraft().currentScreen;
gui.updateAmount(slot.getSlotIndex(), ((Slot) this.inventorySlots.get(idx)).getStack().stackSize);
}
break;
}
}
@@ -62,24 +55,6 @@ public class ContainerLevelMaintainer extends AEBaseContainer {
}
}
@Override
public void onSlotChange(final Slot s) {
if (Platform.isServer()) {
for (final Object crafter : this.crafters) {
final ICrafting icrafting = (ICrafting) crafter;
for (final Object g : this.inventorySlots) {
if (g instanceof OptionalSlotFake || g instanceof SlotFakeCraftingMatrix) {
final Slot sri = (Slot) g;
icrafting.sendSlotContents(this, sri.slotNumber, sri.getStack());
}
}
((EntityPlayerMP) icrafting).isChangingQuantityOnly = false;
}
this.detectAndSendChanges();
}
}
public static class FakeSlot extends ContainerFluidPatternEncoder.SlotFluidConvertingFake {
public FakeSlot(AeItemStackHandler inv, int idx, int x, int y) {
@@ -613,22 +613,10 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
assert !ow.hasNext();
}
public void doubleStacks(boolean isShift)
{
if (!isCraftingMode() && canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots))
{
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
if (isShift && !containsFluid(outputSlots) && !containsFluid(craftingSlots))
{
while (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots))
{
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
}
}
this.detectAndSendChanges();
}
static boolean containsItem(SlotFake[] slots) {
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
long item = enabledSlots.stream().filter(s -> s.getStack() != null && !Util.isFluidPacket(s.getStack())).count();
return item > 0;
}
static boolean containsFluid(SlotFake[] slots) {
@@ -637,4 +625,18 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
return fluid > 0;
}
public void doubleStacks(boolean isShift) {
if (!isCraftingMode() && canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
if (isShift && (containsItem(outputSlots) || containsItem(craftingSlots))) {
while (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
}
}
this.detectAndSendChanges();
}
}
}
@@ -447,20 +447,10 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
assert !ow.hasNext();
}
public void doubleStacks(boolean isShift)
{
if (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots))
{
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
if (isShift && !containsFluid(outputSlots) && !containsFluid(craftingSlots)) {
while (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
}
}
this.detectAndSendChanges();
}
static boolean containsItem(SlotFake[] slots) {
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
long item = enabledSlots.stream().filter(s -> s.getStack() != null && !Util.isFluidPacket(s.getStack())).count();
return item > 0;
}
private boolean canBeSubstitute() {
@@ -473,6 +463,20 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
return fluid > 0;
}
public void doubleStacks(boolean isShift) {
if (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
if (isShift && (containsItem(outputSlots) || containsItem(craftingSlots))) {
while (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
}
}
this.detectAndSendChanges();
}
}
public void setActivePage(final int activePage) {
this.activePage = activePage;
}