Skip to content

Commit

Permalink
Merge remote-tracking branch 'asdflj/master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master committed Jan 10, 2024
2 parents cea6679 + 453147f commit 1d020ba
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 34 deletions.
66 changes: 34 additions & 32 deletions src/main/java/com/glodblock/github/client/gui/GuiMagnet.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.glodblock.github.client.gui;

import java.util.List;

import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
Expand All @@ -24,36 +26,36 @@
public class GuiMagnet extends AEBaseMEGui {

protected FCGuiBaseButton listModeBtn;
protected ContainerMagnet cont;
protected ContainerMagnet container;
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/magnet_filter.png");

protected Component components[] = new Component[3];
protected Component[] components = new Component[3];
protected GuiTabButton originalGuiBtn;
protected GuiImgButton clearBtn;

public GuiMagnet(InventoryPlayer ip, ITerminalHost container) {
super(new ContainerMagnet(ip, container));
this.xSize = 195;
this.ySize = 214;
this.cont = (ContainerMagnet) this.inventorySlots;
this.container = (ContainerMagnet) this.inventorySlots;

}

private class Component {
private static class Component {

private GuiFCImgButton enable;
private GuiFCImgButton disable;
private String action;
private final GuiFCImgButton enable;
private final GuiFCImgButton disable;
private final String action;

private boolean value;

public Component(int x, int y, boolean value, String action) {
public Component(int x, int y, boolean value, String action, List<GuiButton> buttons) {
this.enable = new GuiFCImgButton(x, y, "ENABLE_12x", "ENABLE", false);
this.disable = new GuiFCImgButton(x, y, "DISABLE_12x", "DISABLE", false);
this.value = value;
this.action = action;
buttonList.add(this.enable);
buttonList.add(this.disable);
buttons.add(this.enable);
buttons.add(this.disable);
}

public boolean sameBtn(GuiButton btn) {
Expand All @@ -73,17 +75,13 @@ public void send() {
}

public void draw() {
if (value) {
this.enable.visible = true;
this.disable.visible = false;
} else {
this.enable.visible = false;
this.disable.visible = true;
}
this.enable.visible = value;
this.disable.visible = !value;
}
}

@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
this.buttonList.clear();
Expand All @@ -96,31 +94,34 @@ public void initGui() {
64,
14,
NameConst.i18n(
this.cont.listMode == ItemMagnetCard.ListMode.WhiteList
this.container.listMode == ItemMagnetCard.ListMode.WhiteList
? NameConst.GUI_MAGNET_CARD_WhiteList
: NameConst.GUI_MAGNET_CARD_BlackList)));
this.components[0] = new Component(
this.guiLeft + 156,
this.guiTop + 18,
this.cont.nbt,
"WirelessTerminal.magnet.NBT");
this.container.nbt,
"WirelessTerminal.magnet.NBT",
this.buttonList);
this.components[1] = new Component(
this.guiLeft + 156,
this.guiTop + 31,
this.cont.meta,
"WirelessTerminal.magnet.Meta");
this.container.meta,
"WirelessTerminal.magnet.Meta",
this.buttonList);
this.components[2] = new Component(
this.guiLeft + 156,
this.guiTop + 44,
this.cont.ore,
"WirelessTerminal.magnet.Ore");
this.container.ore,
"WirelessTerminal.magnet.Ore",
this.buttonList);

this.buttonList.add(
this.originalGuiBtn = new GuiTabButton(
this.guiLeft + this.xSize - 44,
this.guiTop - 4,
this.cont.getPortableCell().getItemStack(),
this.cont.getPortableCell().getItemStack().getDisplayName(),
this.container.getPortableCell().getItemStack(),
this.container.getPortableCell().getItemStack().getDisplayName(),
itemRender));
this.originalGuiBtn.setHideEdge(13); // GuiTabButton implementation //

Expand All @@ -138,14 +139,14 @@ public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_MAGNET_CARD_META)), 61, 34, 0x404040);
this.fontRendererObj
.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_MAGNET_CARD_ORE)), 61, 46, 0x404040);
this.components[0].setValue(this.cont.nbt);
this.components[1].setValue(this.cont.meta);
this.components[2].setValue(this.cont.ore);
this.components[0].setValue(this.container.nbt);
this.components[1].setValue(this.container.meta);
this.components[2].setValue(this.container.ore);
for (Component c : components) {
c.draw();
}
this.listModeBtn.displayString = NameConst.i18n(
this.cont.listMode == ItemMagnetCard.ListMode.WhiteList ? NameConst.GUI_MAGNET_CARD_WhiteList
this.container.listMode == ItemMagnetCard.ListMode.WhiteList ? NameConst.GUI_MAGNET_CARD_WhiteList
: NameConst.GUI_MAGNET_CARD_BlackList);
}

Expand All @@ -167,9 +168,10 @@ protected void actionPerformed(GuiButton btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidTerminalBtns(
"WirelessTerminal.magnet.FilterMode",
this.cont.listMode != ItemMagnetCard.ListMode.WhiteList));
this.container.listMode != ItemMagnetCard.ListMode.WhiteList));
} else if (btn == this.originalGuiBtn) {
InventoryHandler.switchGui(ItemWirelessUltraTerminal.readMode(this.cont.getPortableCell().getItemStack()));
InventoryHandler
.switchGui(ItemWirelessUltraTerminal.readMode(this.container.getPortableCell().getItemStack()));
} else if (btn == this.clearBtn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidTerminalBtns("WirelessTerminal.magnet.clear", 1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import static com.glodblock.github.loader.recipe.WirelessTerminalEnergyRecipe.getEnergyCard;
import static com.glodblock.github.loader.recipe.WirelessTerminalInfinityBoosterRecipe.getInfinityBoosterCard;
import static com.glodblock.github.loader.recipe.WirelessTerminalMagnetRecipe.getMagnetCard;
import static com.glodblock.github.util.Util.Wireless.*;
import static com.glodblock.github.util.Util.Wireless.hasEnergyCard;
import static com.glodblock.github.util.Util.Wireless.hasInfinityBoosterCard;
import static com.glodblock.github.util.Util.Wireless.hasMagnetCard;

import java.util.List;

Expand Down
55 changes: 54 additions & 1 deletion src/main/java/com/glodblock/github/loader/RecipeLoader.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,60 @@
package com.glodblock.github.loader;

import static com.glodblock.github.common.storage.CellType.Cell16384kPart;
import static com.glodblock.github.loader.ItemAndBlockHolder.*;
import static com.glodblock.github.loader.ItemAndBlockHolder.BUFFER;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL1024K;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL1024KM;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL16384K;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL16384KM;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL16K;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL16KM;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL1K;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL1KM;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL256K;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL256KM;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL4096K;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL4096KM;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL4K;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL4KM;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL64K;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL64KM;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL_HOUSING;
import static com.glodblock.github.loader.ItemAndBlockHolder.CERTUS_QUARTZ_TANK;
import static com.glodblock.github.loader.ItemAndBlockHolder.DECODER;
import static com.glodblock.github.loader.ItemAndBlockHolder.DISCRETIZER;
import static com.glodblock.github.loader.ItemAndBlockHolder.ENCODER;
import static com.glodblock.github.loader.ItemAndBlockHolder.ENERGY_CARD;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_AUTO_FILLER;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_BUFFER;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_CONVERSION_MONITOR;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_EXPORT_BUS;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_IMPORT_BUS;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_INTERFACE;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_INTERFACE_P2P;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_LEVEL_EMITTER;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_STORAGE_BUS;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_STORAGE_MONITOR;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_TERM;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_TERMINAL;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_TERMINAL_EX;
import static com.glodblock.github.loader.ItemAndBlockHolder.INFINITY_WATER_CELL;
import static com.glodblock.github.loader.ItemAndBlockHolder.INTERFACE;
import static com.glodblock.github.loader.ItemAndBlockHolder.LARGE_BUFFER;
import static com.glodblock.github.loader.ItemAndBlockHolder.LEVEL_MAINTAINER;
import static com.glodblock.github.loader.ItemAndBlockHolder.LEVEL_TERMINAL;
import static com.glodblock.github.loader.ItemAndBlockHolder.MAGNET_CARD;
import static com.glodblock.github.loader.ItemAndBlockHolder.OC_EDITOR;
import static com.glodblock.github.loader.ItemAndBlockHolder.PATTERN;
import static com.glodblock.github.loader.ItemAndBlockHolder.PORTABLE_FLUID_CELL;
import static com.glodblock.github.loader.ItemAndBlockHolder.QUANTUM_BRIDGE_CARD;
import static com.glodblock.github.loader.ItemAndBlockHolder.QUANTUM_CELL;
import static com.glodblock.github.loader.ItemAndBlockHolder.SINGULARITY_CELL;
import static com.glodblock.github.loader.ItemAndBlockHolder.WALRUS;
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_FLUID_TERM;
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_INTERFACE_TERM;
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_LEVEL_TERM;
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_PATTERN_TERM;
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_ULTRA_TERM;
import static com.glodblock.github.loader.recipe.WirelessTerminalEnergyRecipe.energyCards;
import static com.glodblock.github.loader.recipe.WirelessTerminalInfinityBoosterRecipe.infCards;
import static com.glodblock.github.loader.recipe.WirelessTerminalMagnetRecipe.magnetCards;
Expand Down

0 comments on commit 1d020ba

Please sign in to comment.