mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-11 15:57:55 +00:00
fix bugs
This commit is contained in:
1 parent
f22bebbf21
commit
c1b2400549
23 files changed
+252
-105
No files matched your search
@@ -1,36 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
public class FCGuiSwitchTerminal {
|
||||
|
||||
private GuiFCImgButton fluidBtn;
|
||||
private GuiFCImgButton essentiaBtn;
|
||||
private GuiFCImgButton craftBtn;
|
||||
private GuiFCImgButton patternBtn;
|
||||
private final GuiType originGui;
|
||||
|
||||
public FCGuiSwitchTerminal(GuiType gui) {
|
||||
this.originGui = gui;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void addButtons(List buttonList, int offsetX, int offsetY) {
|
||||
int y = 0;
|
||||
if (this.originGui != GuiType.WIRELESS_FLUID_TERMINAL) {
|
||||
buttonList.add(fluidBtn = new GuiFCImgButton(offsetX, offsetY + y, "FLUID_TEM", "YES"));
|
||||
y += 20;
|
||||
}
|
||||
if (ModAndClassUtil.ThE && this.originGui != GuiType.WIRELESS_ESSENTIA_TERMINAL) {
|
||||
buttonList.add(essentiaBtn = new GuiFCImgButton(offsetX, offsetY + y, "ESSENTIA_TEM", "YES"));
|
||||
y += 20;
|
||||
}
|
||||
buttonList.add(craftBtn = new GuiFCImgButton(offsetX, offsetY + y, "CRAFT_TEM", "YES"));
|
||||
y += 20;
|
||||
buttonList.add(patternBtn = new GuiFCImgButton(offsetX, offsetY + y, "PATTERN_TEM", "YES"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,9 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -90,6 +93,15 @@ public class GuiEssentiaTerminal extends GuiFluidMonitor {
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == craftingStatusBtn) {
|
||||
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
public void update(ItemStack itemStack) {
|
||||
this.player.inventory.setItemStack(itemStack);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessFluidTerminalInventory;
|
||||
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -64,14 +69,18 @@ public class GuiFluidCraftAmount extends FCGuiAmount {
|
||||
if (target instanceof PartFluidPatternTerminal) {
|
||||
this.myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL, 1);
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
}
|
||||
if (target instanceof PartFluidPatternTerminalEx) {
|
||||
} else if (target instanceof PartFluidPatternTerminalEx) {
|
||||
this.myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL_EX, 1);
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
}
|
||||
if (target instanceof PartFluidTerminal) {
|
||||
} else if (target instanceof PartFluidTerminal) {
|
||||
this.myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERM, 1);
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
} else if (target instanceof IWirelessTerminal && ((IWirelessTerminal) target).isUniversal(target)) {
|
||||
this.myIcon = new ItemStack(ItemAndBlockHolder.WIRELESS_ULTRA_TERM, 1);
|
||||
this.originalGui = ItemWirelessUltraTerminal.readMode(((IWirelessTerminal) target).getItemStack());
|
||||
} else if (target instanceof WirelessPatternTerminalInventory) {
|
||||
this.myIcon = new ItemStack(ItemAndBlockHolder.WIRELESS_PATTERN_TERM, 1);
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.glodblock.github.client.gui;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -62,9 +65,12 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
|
||||
|
||||
if (te instanceof PartFluidPatternTerminal) {
|
||||
this.OriginalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
}
|
||||
if (te instanceof PartFluidPatternTerminalEx) {
|
||||
} else if (te instanceof PartFluidPatternTerminalEx) {
|
||||
this.OriginalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
} else if (te instanceof IWirelessTerminal && ((IWirelessTerminal) te).isUniversal(te)) {
|
||||
this.OriginalGui = ItemWirelessUltraTerminal.readMode(((IWirelessTerminal) te).getItemStack());
|
||||
} else if (te instanceof WirelessPatternTerminalInventory) {
|
||||
this.OriginalGui = GuiType.FLUID_TERMINAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -29,18 +31,22 @@ public class GuiFluidCraftingWireless extends GuiItemMonitor {
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
if (this.clearBtn == btn) {
|
||||
Slot s = null;
|
||||
final Container c = this.inventorySlots;
|
||||
for (final Object j : c.inventorySlots) {
|
||||
if (j instanceof SlotCraftingMatrix) {
|
||||
s = (Slot) j;
|
||||
if (btn == craftingStatusBtn) {
|
||||
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
if (this.clearBtn == btn) {
|
||||
Slot s = null;
|
||||
final Container c = this.inventorySlots;
|
||||
for (final Object j : c.inventorySlots) {
|
||||
if (j instanceof SlotCraftingMatrix) {
|
||||
s = (Slot) j;
|
||||
}
|
||||
}
|
||||
if (s != null) {
|
||||
final PacketInventoryAction p = new PacketInventoryAction(InventoryAction.MOVE_REGION, s.slotNumber, 0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
}
|
||||
}
|
||||
if (s != null) {
|
||||
final PacketInventoryAction p = new PacketInventoryAction(InventoryAction.MOVE_REGION, s.slotNumber, 0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -1,5 +1,7 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -36,12 +38,13 @@ 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 IWirelessTerminal && ((IWirelessTerminal) host).isUniversal(host)) {
|
||||
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.WIRELESS_ULTRA_TERM, 1));
|
||||
} else if (host instanceof WirelessFluidTerminalInventory) {
|
||||
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.WIRELESS_FLUID_TERM, 1));
|
||||
} else if (host instanceof WirelessPatternTerminalInventory) {
|
||||
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.WIRELESS_PATTERN_TERM, 1));
|
||||
}
|
||||
|
||||
super.initGui();
|
||||
originalGuiBtn = Ae2ReflectClient.getOriginalGuiButton(this);
|
||||
}
|
||||
@@ -53,6 +56,8 @@ 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 IWirelessTerminal && ((IWirelessTerminal) host).isUniversal(host))
|
||||
InventoryHandler.switchGui(ItemWirelessUltraTerminal.readMode(((IWirelessTerminal) host).getItemStack()));
|
||||
else if (host instanceof WirelessFluidTerminalInventory)
|
||||
InventoryHandler.switchGui(GuiType.WIRELESS_FLUID_TERMINAL);
|
||||
else if (host instanceof WirelessPatternTerminalInventory)
|
||||
|
||||
@@ -9,5 +9,4 @@ public class GuiFluidPatternWireless extends GuiFluidPatternTerminal {
|
||||
public GuiFluidPatternWireless(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
|
||||
super(inventoryPlayer, te);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -66,10 +69,15 @@ public class GuiPatternValueAmount extends FCGuiAmount {
|
||||
if (target instanceof PartFluidPatternTerminal) {
|
||||
this.myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL, 1);
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
}
|
||||
if (target instanceof PartFluidPatternTerminalEx) {
|
||||
} else if (target instanceof PartFluidPatternTerminalEx) {
|
||||
this.myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL_EX, 1);
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
} else if (target instanceof IWirelessTerminal && ((IWirelessTerminal) target).isUniversal(target)) {
|
||||
this.myIcon = new ItemStack(ItemAndBlockHolder.WIRELESS_ULTRA_TERM, 1);
|
||||
this.originalGui = ItemWirelessUltraTerminal.readMode(((IWirelessTerminal) target).getItemStack());
|
||||
} else if (target instanceof WirelessPatternTerminalInventory) {
|
||||
this.myIcon = new ItemStack(ItemAndBlockHolder.WIRELESS_PATTERN_TERM, 1);
|
||||
this.originalGui = GuiType.WIRELESS_FLUID_PATTERN_TERMINAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
|
||||
protected int rows = 0;
|
||||
protected int maxRows = Integer.MAX_VALUE;
|
||||
protected int standardSize;
|
||||
protected int offsetY;
|
||||
protected GuiImgButton ViewBox;
|
||||
protected GuiImgButton SortByBox;
|
||||
protected GuiImgButton SortDirBox;
|
||||
@@ -200,60 +201,60 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
|
||||
final int unusedSpace = this.height - this.ySize;
|
||||
this.guiTop = (int) Math.floor(unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f));
|
||||
|
||||
int offset = this.guiTop + 8;
|
||||
this.offsetY = this.guiTop + 8;
|
||||
|
||||
if (this.customSortOrder) {
|
||||
this.buttonList.add(
|
||||
this.SortByBox = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
offset,
|
||||
this.offsetY,
|
||||
Settings.SORT_BY,
|
||||
this.configSrc.getSetting(Settings.SORT_BY)));
|
||||
offset += 20;
|
||||
this.offsetY += 20;
|
||||
}
|
||||
if (this.showViewBtn) {
|
||||
this.buttonList.add(
|
||||
this.ViewBox = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
offset,
|
||||
this.offsetY,
|
||||
Settings.VIEW_MODE,
|
||||
this.configSrc.getSetting(Settings.VIEW_MODE)));
|
||||
offset += 20;
|
||||
this.offsetY += 20;
|
||||
}
|
||||
|
||||
this.buttonList.add(
|
||||
this.SortDirBox = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
offset,
|
||||
this.offsetY,
|
||||
Settings.SORT_DIRECTION,
|
||||
this.configSrc.getSetting(Settings.SORT_DIRECTION)));
|
||||
offset += 20;
|
||||
this.offsetY += 20;
|
||||
|
||||
this.buttonList.add(
|
||||
this.searchBoxSettings = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
offset,
|
||||
this.offsetY,
|
||||
Settings.SEARCH_MODE,
|
||||
AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE)));
|
||||
offset += 20;
|
||||
this.offsetY += 20;
|
||||
|
||||
if (ModAndClassUtil.isSaveText) {
|
||||
this.buttonList.add(
|
||||
this.searchStringSave = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
offset,
|
||||
this.offsetY,
|
||||
Settings.SAVE_SEARCH,
|
||||
AEConfig.instance.preserveSearchBar ? YesNo.YES : YesNo.NO));
|
||||
offset += 20;
|
||||
this.offsetY += 20;
|
||||
}
|
||||
|
||||
this.buttonList.add(
|
||||
this.terminalStyleBox = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
offset,
|
||||
this.offsetY,
|
||||
Settings.TERMINAL_STYLE,
|
||||
AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE)));
|
||||
offset += 20;
|
||||
this.offsetY += 20;
|
||||
|
||||
this.searchField = new FCGuiTextField(
|
||||
this.fontRendererObj,
|
||||
@@ -274,9 +275,10 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
|
||||
this.buttonList.add(
|
||||
this.craftingStatusImgBtn = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
offset,
|
||||
this.offsetY,
|
||||
Settings.CRAFTING_STATUS,
|
||||
AEConfig.instance.settings.getSetting(Settings.CRAFTING_STATUS)));
|
||||
this.offsetY += 20;
|
||||
} else {
|
||||
this.buttonList.add(
|
||||
this.craftingStatusBtn = new GuiTabButton(
|
||||
|
||||
@@ -4,7 +4,6 @@ import static com.glodblock.github.loader.recipe.WirelessTerminalRecipe.getInfin
|
||||
import static com.glodblock.github.util.Util.hasInfinityBoosterCard;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -36,7 +35,7 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
|
||||
|
||||
public ItemBaseWirelessTerminal(GuiType t) {
|
||||
super();
|
||||
this.type = Optional.of(t).get();
|
||||
this.type = t;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,7 +64,7 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
|
||||
w,
|
||||
new BlockPos(player.inventory.currentItem, 0, 0),
|
||||
ForgeDirection.UNKNOWN,
|
||||
this.type);
|
||||
this.guiGuiType(item));
|
||||
} else {
|
||||
player.addChatMessage(PlayerMessages.DeviceNotPowered.get());
|
||||
}
|
||||
@@ -112,11 +111,7 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setGuiType(GuiType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public GuiType guiGuiType() {
|
||||
public GuiType guiGuiType(ItemStack stack) {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -22,19 +26,29 @@ import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||
import com.glodblock.github.loader.IRegister;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
implements IRegister<ItemWirelessUltraTerminal> {
|
||||
|
||||
public final static String MODE = "mode";
|
||||
public final static String MODE = "mode_main";
|
||||
private final static List<GuiType> guis = new ArrayList<>();
|
||||
|
||||
public ItemWirelessUltraTerminal() {
|
||||
super(GuiType.WIRELESS_ESSENTIA_TERMINAL);
|
||||
super(null);
|
||||
AEApi.instance().registries().wireless().registerWirelessHandler(this);
|
||||
this.setFeature(EnumSet.of(AEFeature.WirelessAccessTerminal, AEFeature.PoweredTools));
|
||||
setUnlocalizedName(NameConst.ITEM_WIRELESS_ULTRA_TERMINAL);
|
||||
setTextureName(FluidCraft.resource(NameConst.ITEM_WIRELESS_ULTRA_TERMINAL).toString());
|
||||
guis.add(GuiType.WIRELESS_CRAFTING_TERMINAL);
|
||||
guis.add(GuiType.WIRELESS_FLUID_PATTERN_TERMINAL);
|
||||
guis.add(GuiType.WIRELESS_FLUID_TERMINAL);
|
||||
if (ModAndClassUtil.ThE) {
|
||||
guis.add(GuiType.WIRELESS_ESSENTIA_TERMINAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,15 +58,34 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
return this;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addCheckedInformation(ItemStack stack, EntityPlayer player, List<String> lines,
|
||||
boolean displayMoreInfo) {
|
||||
super.addCheckedInformation(stack, player, lines, displayMoreInfo);
|
||||
lines.add(StatCollector.translateToLocal(NameConst.TT_ULTRA_TERMINAL));
|
||||
lines.add(StatCollector.translateToLocal(NameConst.TT_ULTRA_TERMINAL + "." + guiGuiType(stack)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return StatCollector.translateToLocalFormatted(
|
||||
"item.wireless_ultra_terminal." +
|
||||
guiGuiType(stack) +
|
||||
".name"
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getInventory(ItemStack stack, World world, int x, int y, int z, EntityPlayer player) {
|
||||
try {
|
||||
IGridNode gridNode = Util.getWirelessGrid(stack);
|
||||
if (gridNode != null) {
|
||||
if (this.type == GuiType.WIRELESS_FLUID_PATTERN_TERMINAL) {
|
||||
GuiType gui = readMode(stack);
|
||||
if (gui == GuiType.WIRELESS_FLUID_PATTERN_TERMINAL) {
|
||||
return new WirelessPatternTerminalInventory(stack, x, gridNode, player);
|
||||
}
|
||||
if (this.type == GuiType.WIRELESS_CRAFTING_TERMINAL) {
|
||||
if (gui == GuiType.WIRELESS_CRAFTING_TERMINAL) {
|
||||
return new WirelessCraftingTerminalInventory(stack, x, gridNode, player);
|
||||
} else {
|
||||
return new WirelessFluidTerminalInventory(stack, x, gridNode, player);
|
||||
@@ -66,26 +99,49 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(final ItemStack item, final World w, final EntityPlayer player) {
|
||||
if (player.isSneaking()) {
|
||||
setNext(readMode(item), item);
|
||||
return item;
|
||||
}
|
||||
readMode(item);
|
||||
return super.onItemRightClick(item, w, player);
|
||||
}
|
||||
|
||||
public void readMode(ItemStack stack) {
|
||||
public static GuiType readMode(ItemStack stack) {
|
||||
NBTTagCompound data = Platform.openNbtData(stack);
|
||||
if (data.hasKey(MODE)) {
|
||||
String GUI = data.getString(MODE);
|
||||
try {
|
||||
this.type = GuiType.valueOf(GUI);
|
||||
return GuiType.valueOf(GUI);
|
||||
} catch (IllegalArgumentException e) {
|
||||
this.type = GuiType.WIRELESS_CRAFTING_TERMINAL;
|
||||
return GuiType.WIRELESS_CRAFTING_TERMINAL;
|
||||
}
|
||||
} else {
|
||||
this.type = GuiType.WIRELESS_CRAFTING_TERMINAL;
|
||||
return GuiType.WIRELESS_CRAFTING_TERMINAL;
|
||||
}
|
||||
}
|
||||
|
||||
public void setNext(GuiType type, ItemStack stack) {
|
||||
boolean f = false;
|
||||
for (GuiType g : guis) {
|
||||
if (f) {
|
||||
setMode(g.toString(), stack);
|
||||
return;
|
||||
}
|
||||
if (g == type) {
|
||||
f = true;
|
||||
}
|
||||
}
|
||||
setMode(guis.get(0).toString(), stack);
|
||||
}
|
||||
|
||||
public void setMode(String mode, ItemStack stack) {
|
||||
NBTTagCompound data = Platform.openNbtData(stack);
|
||||
data.setString(MODE, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiType guiGuiType(ItemStack stack) {
|
||||
return readMode(stack);
|
||||
}
|
||||
}
|
||||
@@ -313,15 +313,28 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_CRAFTING_AMOUNT(new PartGuiFactory<FCPart>(FCPart.class) {
|
||||
FLUID_CRAFTING_CONFIRM_ITEM(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, FCPart inv) {
|
||||
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
|
||||
return new ContainerFluidCraftConfirm(player.inventory, inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createClientGui(EntityPlayer player, IWirelessTerminal inv) {
|
||||
return new GuiFluidCraftConfirm(player.inventory, inv);
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_CRAFTING_AMOUNT(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
return new ContainerCraftAmount(player.inventory, inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createClientGui(EntityPlayer player, FCPart inv) {
|
||||
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
|
||||
return new GuiFluidCraftAmount(player.inventory, inv);
|
||||
}
|
||||
}),
|
||||
@@ -339,15 +352,15 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
PATTERN_VALUE_SET(new PartGuiFactory<FCPart>(FCPart.class) {
|
||||
PATTERN_VALUE_SET(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, FCPart inv) {
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
return new ContainerPatternValueAmount(player.inventory, inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createClientGui(EntityPlayer player, FCPart inv) {
|
||||
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
|
||||
return new GuiPatternValueAmount(player.inventory, inv);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
package com.glodblock.github.inventory.item;
|
||||
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IWirelessTerminal extends IFluidPortableCell, IViewCellStorage, IAEAppEngInventory, IGridHost {
|
||||
public interface IWirelessTerminal extends IFluidPortableCell, IViewCellStorage, IAEAppEngInventory, IGridHost, IActionHost {
|
||||
|
||||
default boolean isUniversal(Object holder) {
|
||||
if (holder instanceof IGuiItemObject) {
|
||||
ItemStack stack = ((IGuiItemObject) holder).getItemStack();
|
||||
return stack != null && stack.getItem() instanceof ItemWirelessUltraTerminal;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+6
-2
@@ -54,8 +54,8 @@ public class WirelessCraftingTerminalInventory extends MEMonitorHandler<IAEItemS
|
||||
this.inventorySlot = slot;
|
||||
this.viewCell = new WirelessTerminalViewCells(is);
|
||||
this.channel = StorageChannel.ITEMS;
|
||||
this.crafting = new ItemBiggerAppEngInventory(is, "crafting", 9);
|
||||
this.output = new ItemBiggerAppEngInventory(is, "output", 3);
|
||||
this.crafting = new ItemBiggerAppEngInventory(is, "crafting_c", 9);
|
||||
this.output = new ItemBiggerAppEngInventory(is, "output_c", 3);
|
||||
}
|
||||
|
||||
public StorageChannel getChannel() {
|
||||
@@ -148,4 +148,8 @@ public class WirelessCraftingTerminalInventory extends MEMonitorHandler<IAEItemS
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getActionableNode() {
|
||||
return this.grid;
|
||||
}
|
||||
}
|
||||
@@ -121,6 +121,11 @@ public class WirelessFluidTerminalInventory extends MEMonitorHandler<IAEFluidSta
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getActionableNode() {
|
||||
return this.grid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack,
|
||||
ItemStack newStack) {}
|
||||
|
||||
+5
@@ -311,4 +311,9 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
|
||||
this.writeToNBT();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getActionableNode() {
|
||||
return this.grid;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -89,14 +89,22 @@ public class CPacketCraftRequest implements IMessage {
|
||||
|
||||
final ContainerOpenContext context = cca.getOpenContext();
|
||||
if (context != null) {
|
||||
|
||||
final TileEntity te = context.getTile();
|
||||
InventoryHandler.openGui(
|
||||
if (te != null) {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
player.worldObj,
|
||||
new BlockPos(te),
|
||||
Objects.requireNonNull(context.getSide()),
|
||||
GuiType.FLUID_CRAFTING_CONFIRM);
|
||||
} else {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
player.worldObj,
|
||||
new BlockPos(player.inventory.currentItem, 0, 0),
|
||||
Objects.requireNonNull(context.getSide()),
|
||||
GuiType.FLUID_CRAFTING_CONFIRM_ITEM);
|
||||
}
|
||||
|
||||
if (player.openContainer instanceof ContainerFluidCraftConfirm) {
|
||||
final ContainerFluidCraftConfirm ccc = (ContainerFluidCraftConfirm) player.openContainer;
|
||||
|
||||
@@ -5,8 +5,10 @@ import java.util.Objects;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -96,12 +98,21 @@ public class CPacketInventoryAction implements IMessage {
|
||||
final ContainerOpenContext context = baseContainer.getOpenContext();
|
||||
if (context != null) {
|
||||
final TileEntity te = context.getTile();
|
||||
InventoryHandler.openGui(
|
||||
if (te != null) {
|
||||
InventoryHandler.openGui(
|
||||
sender,
|
||||
te.getWorldObj(),
|
||||
new BlockPos(te),
|
||||
Objects.requireNonNull(baseContainer.getOpenContext().getSide()),
|
||||
GuiType.FLUID_CRAFTING_AMOUNT);
|
||||
} else {
|
||||
InventoryHandler.openGui(
|
||||
sender,
|
||||
sender.worldObj,
|
||||
new BlockPos(sender.inventory.currentItem, Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM), 0),
|
||||
ForgeDirection.UNKNOWN,
|
||||
GuiType.FLUID_CRAFTING_AMOUNT);
|
||||
}
|
||||
if (sender.openContainer instanceof ContainerCraftAmount) {
|
||||
final ContainerCraftAmount cca = (ContainerCraftAmount) sender.openContainer;
|
||||
if (baseContainer.getTargetStack() != null) {
|
||||
@@ -115,12 +126,21 @@ public class CPacketInventoryAction implements IMessage {
|
||||
final ContainerOpenContext context = baseContainer.getOpenContext();
|
||||
if (context != null && message.stack != null) {
|
||||
final TileEntity te = context.getTile();
|
||||
InventoryHandler.openGui(
|
||||
if (te != null) {
|
||||
InventoryHandler.openGui(
|
||||
sender,
|
||||
te.getWorldObj(),
|
||||
new BlockPos(te),
|
||||
Objects.requireNonNull(baseContainer.getOpenContext().getSide()),
|
||||
GuiType.PATTERN_VALUE_SET);
|
||||
} else {
|
||||
InventoryHandler.openGui(
|
||||
sender,
|
||||
sender.worldObj,
|
||||
new BlockPos(sender.inventory.currentItem, Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM), 0),
|
||||
ForgeDirection.UNKNOWN,
|
||||
GuiType.PATTERN_VALUE_SET);
|
||||
}
|
||||
int amt = (int) message.stack.getStackSize();
|
||||
if (message.stack.getItem() instanceof ItemFluidPacket) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(message.stack);
|
||||
|
||||
@@ -67,12 +67,21 @@ public class CPacketPatternValueSet implements IMessage {
|
||||
final ContainerOpenContext context = cpv.getOpenContext();
|
||||
if (context != null) {
|
||||
final TileEntity te = context.getTile();
|
||||
InventoryHandler.openGui(
|
||||
if (te != null) {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
player.worldObj,
|
||||
new BlockPos(te),
|
||||
Objects.requireNonNull(context.getSide()),
|
||||
message.originGui);
|
||||
} else {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
player.worldObj,
|
||||
new BlockPos(player.inventory.currentItem, 0 , 0),
|
||||
Objects.requireNonNull(context.getSide()),
|
||||
message.originGui);
|
||||
}
|
||||
if (player.openContainer instanceof FCContainerEncodeTerminal) {
|
||||
Slot slot = player.openContainer.getSlot(message.valueIndex);
|
||||
if (slot instanceof SlotFake) {
|
||||
|
||||
@@ -79,7 +79,6 @@ public class CPacketSwitchGuis implements IMessage {
|
||||
Objects.requireNonNull(context.getSide()),
|
||||
message.guiType);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ public class NameConst {
|
||||
public static final String TT_WIRELESS = TT_KEY + "wireless.";
|
||||
public static final String TT_WIRELESS_INSTALLED = TT_WIRELESS + "installed";
|
||||
public static final String TT_FLUID_AUTO_FILLER = TT_KEY + "fluid_auto_filler";
|
||||
public static final String TT_ULTRA_TERMINAL = TT_KEY + "ultra_terminal";
|
||||
|
||||
public static final String WAILA_KEY = FluidCraft.MODID + ".waila.";
|
||||
public static final String WAILA_ENABLE = WAILA_KEY + "enable";
|
||||
|
||||
Reference in new issue
Block a user