mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
pushing to prod without testing
woo!!
This commit is contained in:
parent
b64ab034c7
commit
b588919736
@ -1,5 +1,7 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.inventory.RecipesCommon.AStack;
|
import com.hbm.inventory.RecipesCommon.AStack;
|
||||||
@ -11,6 +13,7 @@ import com.hbm.tileentity.IGUIProvider;
|
|||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
import com.hbm.tileentity.machine.storage.TileEntityCrateTemplate;
|
import com.hbm.tileentity.machine.storage.TileEntityCrateTemplate;
|
||||||
import com.hbm.util.InventoryUtil;
|
import com.hbm.util.InventoryUtil;
|
||||||
|
import com.hbm.util.ItemStackUtil;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
@ -88,9 +91,18 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<ItemStack[], Boolean> cachedItems = new HashMap<>();
|
||||||
|
|
||||||
private boolean hasRequiredItems(List<AStack> recipe, int index) {
|
private boolean hasRequiredItems(List<AStack> recipe, int index) {
|
||||||
int[] indices = getSlotIndicesFromIndex(index);
|
int[] indices = getSlotIndicesFromIndex(index);
|
||||||
return InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], recipe.toArray(new AStack[0]));
|
ItemStack[] copy = ItemStackUtil.carefulCopyArrayTruncate(slots, indices[0], indices[1]);
|
||||||
|
if (cachedItems.get(copy) != null)
|
||||||
|
return cachedItems.get(copy);
|
||||||
|
else {
|
||||||
|
boolean hasItems = InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], recipe.toArray(new AStack[0]));
|
||||||
|
cachedItems.put(copy, hasItems);
|
||||||
|
return hasItems;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasSpaceForItems(ItemStack recipe, int index) {
|
private boolean hasSpaceForItems(ItemStack recipe, int index) {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.inventory.RecipesCommon.AStack;
|
import com.hbm.inventory.RecipesCommon.AStack;
|
||||||
@ -14,6 +15,7 @@ import com.hbm.lib.Library;
|
|||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
import com.hbm.util.InventoryUtil;
|
import com.hbm.util.InventoryUtil;
|
||||||
|
import com.hbm.util.ItemStackUtil;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
@ -127,9 +129,18 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<ItemStack[], Boolean> cachedItems = new HashMap<>();
|
||||||
|
|
||||||
private boolean hasRequiredItems(ChemRecipe recipe, int index) {
|
private boolean hasRequiredItems(ChemRecipe recipe, int index) {
|
||||||
int[] indices = getSlotIndicesFromIndex(index);
|
int[] indices = getSlotIndicesFromIndex(index);
|
||||||
return InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], recipe.inputs);
|
ItemStack[] copy = ItemStackUtil.carefulCopyArrayTruncate(slots, indices[0], indices[1]);
|
||||||
|
if (cachedItems.get(copy) != null)
|
||||||
|
return cachedItems.get(copy);
|
||||||
|
else {
|
||||||
|
boolean hasItems = InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], recipe.inputs);
|
||||||
|
cachedItems.put(copy, hasItems);
|
||||||
|
return hasItems;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasSpaceForItems(ChemRecipe recipe, int index) {
|
private boolean hasSpaceForItems(ChemRecipe recipe, int index) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user