Skip to content

Commit

Permalink
Merge pull request #17 from GTNewHorizons/fix_crash
Browse files Browse the repository at this point in the history
fix crash
  • Loading branch information
Alexdoru authored Sep 10, 2022
2 parents 18edf6d + 8e81621 commit 1eceb6e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 24 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dependencies {
compile("com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev")
compile("com.github.GTNewHorizons:NotEnoughItems:2.2.15-GTNH:dev")
compile("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
compile("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.8.5:dev")
compile("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.8.8:dev")

compileOnly("com.github.GTNewHorizons:Avaritiaddons:1.5.3-GTNH:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:BuildCraftCompat:7.1.11:dev") { transitive = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void onDrawScreen(GuiScreenEvent.DrawScreenEvent.Post event) {
if (this.isCraftingTerm || this.isPatternTerm) {
GuiRecipe gui = (GuiRecipe) event.gui;

IRecipeHandler currentHandler = gui.currenthandlers.get(gui.recipetype);
IRecipeHandler currentHandler = (IRecipeHandler) gui.currenthandlers.get(gui.recipetype);

if (NEECraftingHandler.isCraftingTableRecipe(currentHandler)) {

Expand Down Expand Up @@ -189,7 +189,7 @@ private void initIngredientTracker(GuiRecipe gui) {
for (int i = 0; i < overlayButtons.size(); i++) {
GuiButton overlayButton = overlayButtons.get(i);
if (overlayButton.visible) {
IRecipeHandler handler = gui.currenthandlers.get(gui.recipetype);
IRecipeHandler handler = (IRecipeHandler) gui.currenthandlers.get(gui.recipetype);
int recipeIndex = -1;
if (isGtnhNei) {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.github.vfyjxf.nee.container;

import appeng.api.storage.ITerminalHost;
import appeng.container.implementations.ContainerCraftConfirm;
import appeng.util.Platform;
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm;

public class WCTContainerCraftingConfirm extends ContainerCraftConfirm {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,7 @@ private boolean isCraftingMatrixSlot(GuiContainer gui, Slot slot) {
if (gui instanceof GuiCraftingTerm) {
return slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix;
} else if (GuiUtils.isGuiWirelessCrafting(gui)) {
return slot instanceof net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotCraftingMatrix
|| slot
instanceof
net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotFakeCraftingMatrix;
return slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix;
}
return false;
}
Expand Down Expand Up @@ -274,7 +271,7 @@ public void onActionPerformedEventPre(GuiScreenEvent.ActionPerformedEvent.Pre ev
|| GuiUtils.isGuiWirelessCrafting(guiRecipe.firstGui);
if (isCraftingTerm || isPatternTerm) {
int recipesPerPage = 2;
IRecipeHandler handler = guiRecipe.currenthandlers.get(guiRecipe.recipetype);
IRecipeHandler handler = (IRecipeHandler) guiRecipe.currenthandlers.get(guiRecipe.recipetype);
if (isGtnhNei) {
try {
recipesPerPage = (int) ReflectionHelper.findMethod(
Expand All @@ -291,7 +288,7 @@ public void onActionPerformedEventPre(GuiScreenEvent.ActionPerformedEvent.Pre ev
Minecraft.getMinecraft().displayGuiScreen(guiRecipe.firstGui);
overlayHandler.overlayRecipe(
guiRecipe.firstGui,
guiRecipe.currenthandlers.get(guiRecipe.recipetype),
(IRecipeHandler) guiRecipe.currenthandlers.get(guiRecipe.recipetype),
recipe,
NEIClientUtils.shiftKey());
event.setCanceled(true);
Expand Down
22 changes: 8 additions & 14 deletions src/main/java/com/github/vfyjxf/nee/utils/IngredientTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,10 @@ private List<IAEItemStack> getCraftableStacks() {
ReflectionHelper.findField(ItemRepo.class, "list").get(repo);
} else {
// wireless crafting terminal support
net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo repo =
(net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo)
ReflectionHelper.findField(GuiWirelessCraftingTerminal.class, "repo")
.get(termGui);
list = (IItemList<IAEItemStack>) ReflectionHelper.findField(
net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo.class, "list")
.get(repo);
ItemRepo repo = (ItemRepo) ReflectionHelper.findField(GuiWirelessCraftingTerminal.class, "repo")
.get(termGui);
list = (IItemList<IAEItemStack>)
ReflectionHelper.findField(ItemRepo.class, "list").get(repo);
}
} catch (IllegalAccessException e) {
e.printStackTrace();
Expand Down Expand Up @@ -124,13 +121,10 @@ private List<IAEItemStack> getStorageStacks() {
}
} else {
// wireless crafting terminal support
net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo repo =
(net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo)
ReflectionHelper.findField(GuiWirelessCraftingTerminal.class, "repo")
.get(termGui);
for (IAEItemStack stack : (IItemList<IAEItemStack>) ReflectionHelper.findField(
net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo.class, "list")
.get(repo)) {
ItemRepo repo = (ItemRepo) ReflectionHelper.findField(GuiWirelessCraftingTerminal.class, "repo")
.get(termGui);
for (IAEItemStack stack : (IItemList<IAEItemStack>)
ReflectionHelper.findField(ItemRepo.class, "list").get(repo)) {
list.add(stack.copy());
}
}
Expand Down

0 comments on commit 1eceb6e

Please sign in to comment.