mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-25 22:44:36 +00:00
Compare commits
30
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8954fcdba | ||
|
|
5f52986f95 | ||
|
|
da55c3b12c | ||
|
|
9f74331116 | ||
|
|
cdac4cc4a8 | ||
|
|
9958dd45ff | ||
|
|
a25879aaad | ||
|
|
d8c5870a91 | ||
|
|
96260fe68b | ||
|
|
f44536d2e8 | ||
|
|
fa8342cfed | ||
|
|
82ddc4da41 | ||
|
|
3d1d2f79e5 | ||
|
|
867651ecab | ||
|
|
0674aae0ec | ||
|
|
5277fd36f5 | ||
|
|
b6b31eca33 | ||
|
|
0dbeae9f68 | ||
|
|
f0547b5ca6 | ||
|
|
e7a252a0de | ||
|
|
442118d2e4 | ||
|
|
972d0e4f3c | ||
|
|
bffef55cb8 | ||
|
|
e1d19e0bfc | ||
|
|
b0c5f6fcda | ||
|
|
953638be05 | ||
|
|
e53d728baf | ||
|
|
58b63671ce | ||
|
|
a1631b0f58 | ||
|
|
eafd9ff4a3 |
No files matched your search
@@ -12,6 +12,7 @@ dependencies {
|
||||
|
||||
compileOnly('maven.modrinth:forge-essentials:7.5.1')
|
||||
compileOnly('com.cardinalstar.cubicchunks:CubicChunks1710:v0.1.14-alpha:dev')
|
||||
compileOnly('com.ruling_0:MaterialLib:0.24.0-mu:dev')
|
||||
|
||||
antlr('org.antlr:antlr4:4.13.2')
|
||||
shadowImplementation('org.antlr:antlr4-runtime:4.13.2')
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven {
|
||||
name = "Modrinth"
|
||||
url = "https://api.modrinth.com/maven"
|
||||
|
||||
@@ -192,10 +192,9 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
|
||||
builder = BookmarkItem.builder(groupId, itemStack, recipe, BookmarkItemType.RESULT).multiplier(1);
|
||||
} else if (recipeId != null) {
|
||||
builder = BookmarkItem.builder(groupId, itemStack).recipeId(recipeId)
|
||||
.factor(StackInfo.getAmountLong(itemStack)).multiplier(1);
|
||||
.factor(StackInfo.getAmount(itemStack)).multiplier(1);
|
||||
} else {
|
||||
builder = BookmarkItem.builder(groupId, itemStack).factor(1)
|
||||
.multiplier(StackInfo.getAmountLong(itemStack));
|
||||
builder = BookmarkItem.builder(groupId, itemStack).factor(1).multiplier(StackInfo.getAmount(itemStack));
|
||||
}
|
||||
|
||||
if (existsRecipe) {
|
||||
@@ -262,7 +261,7 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
|
||||
builder = BookmarkItem.builder(groupId, stack, recipe, BookmarkItemType.RESULT);
|
||||
} else {
|
||||
builder = BookmarkItem.builder(groupId, stack).recipeId(recipeId)
|
||||
.factor(StackInfo.getAmountLong(stack));
|
||||
.factor(StackInfo.getAmount(stack));
|
||||
}
|
||||
|
||||
this.grid.addItem(builder.multiplier(1).type(BookmarkItemType.ITEM).build(), true);
|
||||
@@ -554,7 +553,7 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
|
||||
}
|
||||
|
||||
protected ItemStack getDraggedStackWithQuantity(ItemStack itemStack) {
|
||||
return ItemQuantityField.prepareStackWithQuantity(itemStack, StackInfo.getAmountLong(itemStack));
|
||||
return ItemQuantityField.prepareStackWithQuantity(itemStack, StackInfo.getAmount(itemStack));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@ import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemsGrid.ItemsGridSlot;
|
||||
import codechicken.nei.ItemsGrid.MouseContext;
|
||||
import codechicken.nei.NEIClientUtils.Alignment;
|
||||
import codechicken.nei.recipe.AutoCraftingManager;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.ICraftingHandler;
|
||||
@@ -39,7 +40,7 @@ public class ItemCraftablesPanel
|
||||
|
||||
public CraftablesGridSlot(int slotIndex, int itemIndex, ItemStack itemStack, RecipeId recipeId) {
|
||||
super(slotIndex, itemIndex, itemStack);
|
||||
this.realAmount = StackInfo.getAmountLong(itemStack);
|
||||
this.realAmount = StackInfo.getAmount(itemStack);
|
||||
this.isFluidDisplay = StackInfo.isFluidDisplayItem(itemStack);
|
||||
this.recipeId = recipeId;
|
||||
}
|
||||
@@ -215,7 +216,7 @@ public class ItemCraftablesPanel
|
||||
|
||||
@Override
|
||||
protected ItemStack getDraggedStackWithQuantity(ItemStack itemStack) {
|
||||
return ItemQuantityField.prepareStackWithQuantity(itemStack, StackInfo.getAmountLong(itemStack));
|
||||
return ItemQuantityField.prepareStackWithQuantity(itemStack, StackInfo.getAmount(itemStack));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -267,7 +268,7 @@ public class ItemCraftablesPanel
|
||||
if (firstGui != null && !ItemCraftablesPanel.guiBlacklist.contains(firstGui.getClass().getName())) {
|
||||
final boolean showOnlyFavorites = NEIClientConfig
|
||||
.getBooleanSetting("inventory.craftables.favoritesOnly");
|
||||
final ItemStackAmount inv = ItemStackAmount.of(firstGui);
|
||||
final ItemStackAmount inv = AutoCraftingManager.getInventoryItems(firstGui);
|
||||
|
||||
if (this.lastGuiContainer != firstGui
|
||||
|| showOnlyFavorites && this.lastFavoritesCount != FavoriteRecipes.size()
|
||||
@@ -316,7 +317,7 @@ public class ItemCraftablesPanel
|
||||
final Map<ItemStack, RecipeId> availableRecipes = new HashMap<>();
|
||||
|
||||
if (!availableHandlers.isEmpty()) {
|
||||
final Map<Item, List<ItemStack>> invByItem = snapshot.inventory.groupByItem();
|
||||
final Map<Item, List<ItemStack>> invByItem = indexInventoryByItem(snapshot.inventory.values());
|
||||
|
||||
if (snapshot.showOnlyFavorites) {
|
||||
for (IRecipeHandler handler : availableHandlers) {
|
||||
@@ -348,6 +349,16 @@ public class ItemCraftablesPanel
|
||||
return availableHandlers;
|
||||
}
|
||||
|
||||
private static Map<Item, List<ItemStack>> indexInventoryByItem(List<ItemStack> invStacks) {
|
||||
final Map<Item, List<ItemStack>> index = new HashMap<>();
|
||||
|
||||
for (ItemStack stack : invStacks) {
|
||||
index.computeIfAbsent(stack.getItem(), i -> new ArrayList<>()).add(stack);
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
private void collectHandlerCandidates(IRecipeHandler handler, Map<Item, List<ItemStack>> invByItem,
|
||||
List<RecipeCandidate> candidates) {
|
||||
IntStream.range(0, handler.numRecipes()).parallel().forEach(recipeIndex -> {
|
||||
@@ -389,11 +400,11 @@ public class ItemCraftablesPanel
|
||||
}
|
||||
|
||||
final ItemStack stack = Recipe.getMainResult(results, pStack -> pStack.items[0]).item;
|
||||
long stackSize = 0;
|
||||
int stackSize = 0;
|
||||
|
||||
for (PositionedStack result : results) {
|
||||
if (containsSameType(result, stack)) {
|
||||
stackSize += StackInfo.getAmountLong(result.item);
|
||||
stackSize += StackInfo.getAmount(result.item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,8 +448,36 @@ public class ItemCraftablesPanel
|
||||
return availableRecipes;
|
||||
}
|
||||
|
||||
private static boolean existsIngredients(List<PositionedStack> ingredients, Map<Item, List<ItemStack>> invByItem) {
|
||||
return !ingredients.isEmpty() && NEIClientUtils.countMissingIngredients(ingredients, invByItem, 1) == 0;
|
||||
private boolean existsIngredients(List<PositionedStack> ingredients, Map<Item, List<ItemStack>> invByItem) {
|
||||
final Map<ItemStack, Integer> usedItems = new HashMap<>();
|
||||
|
||||
for (PositionedStack pStack : ingredients) {
|
||||
ItemStack used = null;
|
||||
|
||||
for (ItemStack permutation : pStack.items) {
|
||||
final List<ItemStack> candidates = invByItem.get(permutation.getItem());
|
||||
|
||||
if (candidates == null) continue;
|
||||
|
||||
for (ItemStack is : candidates) {
|
||||
if (usedItems.getOrDefault(is, is.stackSize) >= pStack.item.stackSize
|
||||
&& NEIServerUtils.areStacksSameTypeCrafting(permutation, is)) {
|
||||
used = is;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (used != null) break;
|
||||
}
|
||||
|
||||
if (used != null) {
|
||||
usedItems.put(used, usedItems.getOrDefault(used, used.stackSize) - pStack.item.stackSize);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return !usedItems.isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +1,12 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.SlotCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -34,7 +29,7 @@ public class ItemStackAmount {
|
||||
}
|
||||
|
||||
public void add(ItemStack item) {
|
||||
add(item, StackInfo.getAmountLong(item));
|
||||
add(item, (long) StackInfo.getAmount(item));
|
||||
}
|
||||
|
||||
public void add(ItemStack stack, Long value) {
|
||||
@@ -101,16 +96,6 @@ public class ItemStackAmount {
|
||||
return list;
|
||||
}
|
||||
|
||||
public Map<Item, List<ItemStack>> groupByItem() {
|
||||
final Map<Item, List<ItemStack>> groups = new HashMap<>();
|
||||
|
||||
for (ItemStack stack : values()) {
|
||||
groups.computeIfAbsent(stack.getItem(), i -> new ArrayList<>()).add(stack);
|
||||
}
|
||||
|
||||
return groups;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.itemMap.size();
|
||||
}
|
||||
@@ -155,16 +140,4 @@ public class ItemStackAmount {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ItemStackAmount of(GuiContainer gui) {
|
||||
final ItemStackAmount result = new ItemStackAmount();
|
||||
|
||||
for (Slot slot : gui.inventorySlots.inventorySlots) {
|
||||
if (slot.getHasStack() && !(slot instanceof SlotCrafting) && slot.canTakeStack(gui.mc.thePlayer)) {
|
||||
result.add(slot.getStack());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
@@ -31,9 +30,7 @@ public class KeyManager {
|
||||
private static final Map<String, KeyBinding> keyBindings = new HashMap<>();
|
||||
private static final Map<String, String> keyAliases = new HashMap<>();
|
||||
private static volatile boolean pendingOptionsReload = false;
|
||||
|
||||
private static final int NO_INPUT_EVENT = Integer.MIN_VALUE;
|
||||
private static int currentEvent = NO_INPUT_EVENT;
|
||||
private static int clickedButton = -1;
|
||||
|
||||
static {
|
||||
// Aliases for legacy keybinds
|
||||
@@ -73,22 +70,16 @@ public class KeyManager {
|
||||
|
||||
public static boolean isKeyDown(String ident) {
|
||||
final KeyBinding binding = getKeyBinding(ident);
|
||||
if (binding == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final int keyCode = binding.getKeyCode();
|
||||
if (currentEvent != NO_INPUT_EVENT) {
|
||||
return keyCode == currentEvent;
|
||||
}
|
||||
if (binding != null) {
|
||||
final int keyCode = binding.getKeyCode();
|
||||
|
||||
if (keyCode < 0) {
|
||||
final int button = keyCode + 100;
|
||||
return Mouse.isButtonDown(button);
|
||||
}
|
||||
|
||||
if (keyCode > Keyboard.KEY_NONE && keyCode < Keyboard.KEYBOARD_SIZE) {
|
||||
return Keyboard.isKeyDown(keyCode);
|
||||
if (keyCode < 0) {
|
||||
final int button = keyCode + 100;
|
||||
return Mouse.isButtonDown(button) || button == clickedButton;
|
||||
} else if (keyCode > Keyboard.KEY_NONE && keyCode < Keyboard.KEYBOARD_SIZE) {
|
||||
return Keyboard.isKeyDown(keyCode);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -106,23 +97,6 @@ public class KeyManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static <T> T withEvent(int code, Supplier<T> handler) {
|
||||
final int previous = currentEvent;
|
||||
currentEvent = code;
|
||||
try {
|
||||
return handler.get();
|
||||
} finally {
|
||||
currentEvent = previous;
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleKeyEvent(int keyCode, Runnable handler) {
|
||||
withEvent(keyCode, () -> {
|
||||
handler.run();
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs a hotkey handler for a click of the given mouse button if the button is bound to any NEI key binding. The
|
||||
* button is reported as down by {@link #isKeyDown} for the duration of the call, because the LWJGL button state can
|
||||
@@ -135,7 +109,14 @@ public class KeyManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
return withEvent(button - 100, handler::getAsBoolean);
|
||||
final int previous = clickedButton;
|
||||
clickedButton = button;
|
||||
|
||||
try {
|
||||
return handler.getAsBoolean();
|
||||
} finally {
|
||||
clickedButton = previous;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isHashDown(String ident) {
|
||||
|
||||
@@ -312,8 +312,7 @@ public class NEIClientUtils extends NEIServerUtils {
|
||||
|
||||
if (StackInfo.isFluidDisplayItem(stack.item)) {
|
||||
final FluidStack requiredFluid = StackInfo.getFluid(stack.item);
|
||||
found = requiredFluid != null
|
||||
&& consumeFluid(invStacks, remainingFluid, requiredFluid, StackInfo.getAmountLong(stack.item));
|
||||
found = requiredFluid != null && consumeFluid(invStacks, remainingFluid, requiredFluid);
|
||||
} else {
|
||||
found = false;
|
||||
|
||||
@@ -333,8 +332,8 @@ public class NEIClientUtils extends NEIServerUtils {
|
||||
}
|
||||
|
||||
private static boolean consumeFluid(List<ItemStack> invStacks, Map<ItemStack, Long> remainingFluid,
|
||||
FluidStack requiredFluid, long requiredAmount) {
|
||||
long need = requiredAmount;
|
||||
FluidStack requiredFluid) {
|
||||
long need = requiredFluid.amount;
|
||||
final List<ItemStack> matched = new ArrayList<>();
|
||||
|
||||
for (ItemStack is : invStacks) {
|
||||
@@ -365,7 +364,7 @@ public class NEIClientUtils extends NEIServerUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
long remainingNeed = requiredAmount;
|
||||
long remainingNeed = requiredFluid.amount;
|
||||
for (ItemStack is : matched) {
|
||||
final long available = remainingFluid.get(is);
|
||||
final long consumed = Math.min(available, remainingNeed);
|
||||
@@ -539,40 +538,6 @@ public class NEIClientUtils extends NEIServerUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int countMissingIngredients(List<PositionedStack> ingredients, Map<Item, List<ItemStack>> index,
|
||||
int limit) {
|
||||
Map<ItemStack, Integer> usedItems = new HashMap<>();
|
||||
int missing = 0;
|
||||
|
||||
for (PositionedStack pStack : ingredients) {
|
||||
ItemStack used = null;
|
||||
|
||||
for (ItemStack permutation : pStack.items) {
|
||||
final List<ItemStack> candidates = index.get(permutation.getItem());
|
||||
|
||||
if (candidates == null) continue;
|
||||
|
||||
for (ItemStack is : candidates) {
|
||||
if (usedItems.getOrDefault(is, is.stackSize) >= pStack.item.stackSize
|
||||
&& NEIServerUtils.areStacksSameTypeCrafting(permutation, is)) {
|
||||
used = is;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (used != null) break;
|
||||
}
|
||||
|
||||
if (used != null) {
|
||||
usedItems.put(used, usedItems.getOrDefault(used, used.stackSize) - pStack.item.stackSize);
|
||||
} else if (++missing >= limit) {
|
||||
return missing;
|
||||
}
|
||||
}
|
||||
|
||||
return missing;
|
||||
}
|
||||
|
||||
public static boolean altKey() {
|
||||
return Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU);
|
||||
}
|
||||
|
||||
@@ -14,11 +14,13 @@ import com.google.common.eventbus.Subscribe;
|
||||
|
||||
import codechicken.core.CommonUtils;
|
||||
import codechicken.core.launch.CodeChickenCorePlugin;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import codechicken.nei.asm.NEICorePlugin;
|
||||
import codechicken.nei.config.IMCHandler;
|
||||
import codechicken.nei.guihook.HideousLinkedList;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.stackinfo.MaterialLibStackStringifyHandler;
|
||||
import cpw.mods.fml.client.FMLFileResourcePack;
|
||||
import cpw.mods.fml.client.FMLFolderResourcePack;
|
||||
import cpw.mods.fml.common.DummyModContainer;
|
||||
@@ -114,6 +116,10 @@ public class NEIModContainer extends DummyModContainer {
|
||||
IMCForNEI.IMCSender();
|
||||
}
|
||||
ServerHandler.load();
|
||||
|
||||
if (Loader.isModLoaded("materiallib")) {
|
||||
API.registerStackStringifyHandler(new MaterialLibStackStringifyHandler());
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -303,9 +303,8 @@ public class PositionedStack implements Cloneable {
|
||||
|
||||
if (fluidStack != null && this.capacity > 0) {
|
||||
tooltip.add(
|
||||
EnumChatFormatting.GRAY + NEIClientUtils.translate(
|
||||
"recipe.fluid.tank.amount",
|
||||
NEIClientUtils.formatFluid(StackInfo.getAmountLong(this.item))));
|
||||
EnumChatFormatting.GRAY + NEIClientUtils
|
||||
.translate("recipe.fluid.tank.amount", NEIClientUtils.formatFluid(fluidStack.amount)));
|
||||
}
|
||||
|
||||
if (customTooltip != null) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -541,14 +542,22 @@ public class SubsetWidget extends Button implements ItemFilterProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
final AtomicInteger resolved = new AtomicInteger();
|
||||
final AtomicInteger invalid = new AtomicInteger();
|
||||
|
||||
Stream.of(dir.listFiles()).filter(file -> !file.isDirectory()).forEach(file -> {
|
||||
ClientHandler.loadSettingsFile(
|
||||
"subsets/" + file.getName(),
|
||||
lines -> parseFile(file.getName(), lines.collect(Collectors.toList())));
|
||||
lines -> parseFile(file.getName(), lines.collect(Collectors.toList()), resolved, invalid));
|
||||
});
|
||||
|
||||
if (resolved.get() + invalid.get() > 0) {
|
||||
NEIClientConfig.logger.info("Resolved {} MaterialLib entries ({} invalid)", resolved.get(), invalid.get());
|
||||
}
|
||||
}
|
||||
|
||||
private static void parseFile(String resource, List<String> itemStrings) {
|
||||
private static void parseFile(String resource, List<String> itemStrings, AtomicInteger resolved,
|
||||
AtomicInteger invalid) {
|
||||
final JsonParser parser = new JsonParser();
|
||||
final int dotIndex = resource.lastIndexOf('.');
|
||||
final String subsetNamespace = dotIndex > 0 ? resource.substring(0, dotIndex) : resource;
|
||||
@@ -578,7 +587,13 @@ public class SubsetWidget extends Button implements ItemFilterProvider {
|
||||
final NBTBase nbt = NBTJson.toNbt(parser.parse(itemStr));
|
||||
|
||||
if (nbt instanceof NBTTagCompound tag) {
|
||||
((ItemStackSet) processedTag.filter).add(StackInfo.loadFromNBT(tag));
|
||||
final ItemStack stack = StackInfo.loadFromNBT(tag);
|
||||
|
||||
if (tag.getString("strId").startsWith(StackInfo.MATERIALLIB_PREFIX)) {
|
||||
(stack != null ? resolved : invalid).incrementAndGet();
|
||||
}
|
||||
|
||||
((ItemStackSet) processedTag.filter).add(stack);
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"Expected NBTTagCompound but got " + nbt.getClass().getSimpleName());
|
||||
|
||||
@@ -21,7 +21,6 @@ import codechicken.nei.BookmarkContainerInfo;
|
||||
import codechicken.nei.FavoriteRecipes;
|
||||
import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.ItemQuantityField;
|
||||
import codechicken.nei.ItemStackAmount;
|
||||
import codechicken.nei.KeyManager;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
@@ -718,7 +717,7 @@ public abstract class ShortcutInputHandler {
|
||||
|
||||
private static void autocraftingIgnoreInventory(RecipeChainMath math) {
|
||||
final GuiContainer guiContainer = NEIClientUtils.getGuiContainer();
|
||||
final List<ItemStack> playerInventory = ItemStackAmount.of(guiContainer).values();
|
||||
final List<ItemStack> playerInventory = AutoCraftingManager.getInventoryItems(guiContainer).values();
|
||||
final RecipeId rootRecipeId = math.createMasterRoot();
|
||||
|
||||
for (int i = 0; i < math.recipeIngredients.size(); i++) {
|
||||
@@ -729,7 +728,7 @@ public abstract class ShortcutInputHandler {
|
||||
|
||||
for (ItemStack stack : playerInventory) {
|
||||
if (NEIClientUtils.areStacksSameTypeCraftingWithNBT(stack, item.itemStack)) {
|
||||
amount += StackInfo.getAmountLong(stack);
|
||||
amount += StackInfo.getAmount(stack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -194,8 +194,7 @@ public class BookmarkGridGenerator {
|
||||
|| group.crafting.calculatedItems.get(shadowIndex).calculatedType == CalculatedType.INGREDIENT;
|
||||
|
||||
final BookmarkItem shadowBookmarkItem = BookmarkItem.builder(bookmarkItem.groupId, bookmarkItem.itemStack)
|
||||
.multiplier(1).factor(StackInfo.getAmountLong(bookmarkItem.itemStack))
|
||||
.recipeId(bookmarkItem.recipeId)
|
||||
.multiplier(1).factor(StackInfo.getAmount(bookmarkItem.itemStack)).recipeId(bookmarkItem.recipeId)
|
||||
.type(isIngredient ? BookmarkItemType.INGREDIENT : BookmarkItemType.RESULT)
|
||||
.permutations(Collections.emptyMap()).build();
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class BookmarkItem {
|
||||
|
||||
this.groupId = groupId;
|
||||
this.stack = stack;
|
||||
this.factor = StackInfo.isFluidDisplayItem(stack) ? Math.max(nbTag.getLong("Count"), 1) : 1;
|
||||
this.factor = StackInfo.isFluidDisplayItem(stack) ? Math.max(nbTag.getInteger("Count"), 1) : 1;
|
||||
}
|
||||
|
||||
public Builder factor(long factor) {
|
||||
@@ -105,7 +105,7 @@ public class BookmarkItem {
|
||||
if (this.multiplier >= 0) {
|
||||
multiplier = this.multiplier;
|
||||
} else if (this.factor > 0) {
|
||||
multiplier = StackInfo.getAmountLong(this.stack) / this.factor;
|
||||
multiplier = StackInfo.getAmount(this.stack) / this.factor;
|
||||
}
|
||||
|
||||
return new BookmarkItem(
|
||||
@@ -234,7 +234,7 @@ public class BookmarkItem {
|
||||
for (RecipeIngredient res : items) {
|
||||
for (ItemStack perm : res.getPermutations()) {
|
||||
if (NEIClientUtils.areStacksSameTypeWithNBT(emptyStack, StackInfo.withAmount(perm, 0))) {
|
||||
amount += 1L * StackInfo.getAmountLong(perm) * res.getChance();
|
||||
amount += 1L * StackInfo.getAmount(perm) * res.getChance();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -271,15 +271,15 @@ public class BookmarkItem {
|
||||
}
|
||||
|
||||
if (jsonObject.has("multiplier")) {
|
||||
builder.multiplier(jsonObject.get("multiplier").getAsLong());
|
||||
builder.multiplier(jsonObject.get("multiplier").getAsInt());
|
||||
}
|
||||
|
||||
if (jsonObject.has("factor")) {
|
||||
builder.factor(jsonObject.get("factor").getAsLong());
|
||||
builder.factor(jsonObject.get("factor").getAsInt());
|
||||
}
|
||||
|
||||
if (jsonObject.has("chance")) {
|
||||
builder.chance(jsonObject.get("chance").getAsLong());
|
||||
builder.chance(jsonObject.get("chance").getAsInt());
|
||||
}
|
||||
|
||||
if (jsonObject.get("recipeId") instanceof JsonObject recipeJson) {
|
||||
@@ -320,9 +320,8 @@ public class BookmarkItem {
|
||||
final ItemStack newPerm = findPermutation(stack);
|
||||
|
||||
if (oldPerm != null && newPerm != null) {
|
||||
final long oldAmount = StackInfo.getAmountLong(oldPerm);
|
||||
final long amount = oldAmount > 0
|
||||
? this.factor * this.chance * StackInfo.getAmountLong(newPerm) / oldAmount
|
||||
final long oldAmount = StackInfo.getAmount(oldPerm);
|
||||
final long amount = oldAmount > 0 ? this.factor * this.chance * StackInfo.getAmount(newPerm) / oldAmount
|
||||
: 0;
|
||||
final long factor = (amount % PositionedStack.CHANCE_FULL) == 0 ? amount / PositionedStack.CHANCE_FULL
|
||||
: 1;
|
||||
@@ -370,9 +369,8 @@ public class BookmarkItem {
|
||||
final ItemStack newPerm = findPermutation(perm);
|
||||
|
||||
if (oldPerm != null && newPerm != null) {
|
||||
final long oldAmount = StackInfo.getAmountLong(oldPerm);
|
||||
final long amount = oldAmount > 0
|
||||
? this.factor * this.chance * StackInfo.getAmountLong(newPerm) / oldAmount
|
||||
final long oldAmount = StackInfo.getAmount(oldPerm);
|
||||
final long amount = oldAmount > 0 ? this.factor * this.chance * StackInfo.getAmount(newPerm) / oldAmount
|
||||
: 0;
|
||||
final long factor = (amount % PositionedStack.CHANCE_FULL) == 0 ? amount / PositionedStack.CHANCE_FULL
|
||||
: 1;
|
||||
|
||||
@@ -36,7 +36,6 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.ItemStackAmount;
|
||||
import codechicken.nei.KeyManager;
|
||||
import codechicken.nei.LRUCache;
|
||||
import codechicken.nei.NEICPH;
|
||||
@@ -61,6 +60,7 @@ import codechicken.nei.guihook.IGuiClientSide;
|
||||
import codechicken.nei.guihook.IGuiHandleMouseWheel;
|
||||
import codechicken.nei.guihook.IGuiHotkeyListener;
|
||||
import codechicken.nei.recipe.AcceptsFollowingTooltipLineHandler;
|
||||
import codechicken.nei.recipe.AutoCraftingManager;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiOverlayButton;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
@@ -284,8 +284,10 @@ public class GuiCraftingTree extends GuiContainer implements INEIGuiHandler, IGu
|
||||
final GuiContainer firstGui = getFirstScreen();
|
||||
|
||||
if (firstGui != null) {
|
||||
for (ItemStack stack : ItemStackAmount.of(firstGui).values()) {
|
||||
this.math.initialItems.add(BookmarkItem.of(-1, stack));
|
||||
for (ItemStack stack : AutoCraftingManager.getInventoryItems(firstGui).values()) {
|
||||
if (stack != null) {
|
||||
this.math.initialItems.add(BookmarkItem.of(-1, stack));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,7 +524,7 @@ class StatsPanel extends ScrollContainer {
|
||||
|
||||
public ItemStack getStackMouseOver(int mouseX, int mouseY) {
|
||||
final Widget widget = getWidgetUnderMouse(mouseX, mouseY);
|
||||
return widget instanceof ItemStatsSlot slot ? slot.getStack() : null;
|
||||
return widget instanceof ItemStatsSlot slot && slot.recipeId == null ? slot.getStack() : null;
|
||||
}
|
||||
|
||||
public void setHighlight(SearchResult searchResult) {
|
||||
|
||||
@@ -51,7 +51,6 @@ import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.NEIModContainer;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import codechicken.nei.recipe.stackinfo.GTFluidStackStringifyHandler;
|
||||
import codechicken.nei.util.ItemUntranslator;
|
||||
import codechicken.nei.util.ReadableNumberConverter;
|
||||
import codechicken.nei.util.RenderTooltipEventHelper;
|
||||
@@ -230,9 +229,7 @@ public class GuiContainerManager {
|
||||
public static String itemCountDetails(ItemStack stack) {
|
||||
final FluidStack fluid = StackInfo.getFluid(stack);
|
||||
if (fluid != null) {
|
||||
// The fluid of a display item is limited to an int, its stored amount is not
|
||||
final long amount = StackInfo.isFluidDisplayItem(stack) ? StackInfo.getAmountLong(stack) : fluid.amount;
|
||||
return fluidAmountDetails(amount * Math.max(1, stack.stackSize));
|
||||
return fluidAmountDetails(fluid.amount * Math.max(1, stack.stackSize));
|
||||
} else {
|
||||
return countDetails(
|
||||
stack.stackSize,
|
||||
@@ -246,35 +243,17 @@ public class GuiContainerManager {
|
||||
@SuppressWarnings("unused")
|
||||
@Nullable
|
||||
public static String fluidAmountDetails(FluidStack fluid) {
|
||||
return fluidAmountDetails(GTFluidStackStringifyHandler.getFluidAmount(fluid));
|
||||
return fluidAmountDetails(fluid.amount);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String fluidAmountDetails(int amount) {
|
||||
return fluidAmountDetails((long) amount);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String fluidAmountDetails(long amount) {
|
||||
if (amount <= 144) return null;
|
||||
|
||||
final long remainder = amount % 144;
|
||||
final String units = NEIClientUtils.formatNumber(amount / 144);
|
||||
|
||||
if (remainder > 0) {
|
||||
return String.format(
|
||||
translate("inventory.tooltip.count.fluid", "%s = %s * %s + %s"),
|
||||
NEIClientUtils.formatFluid(amount),
|
||||
units,
|
||||
NEIClientUtils.formatFluid(144),
|
||||
NEIClientUtils.formatFluid(remainder));
|
||||
}
|
||||
|
||||
return String.format(
|
||||
return countDetails(
|
||||
amount,
|
||||
144,
|
||||
translate("inventory.tooltip.count.fluid", "%s = %s * %s + %s"),
|
||||
translate("inventory.tooltip.count.fluid", "%s = %s * %s"),
|
||||
NEIClientUtils.formatFluid(amount),
|
||||
units,
|
||||
NEIClientUtils.formatFluid(144));
|
||||
NEIClientUtils::formatFluid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -661,7 +640,7 @@ public class GuiContainerManager {
|
||||
tooltip = handler.handleTooltip(window, mousex, mousey, tooltip);
|
||||
}
|
||||
|
||||
ItemStack stack = tooltip.isEmpty() ? getStackMouseOver(window) : null;
|
||||
ItemStack stack = getStackMouseOver(window);
|
||||
boolean showTooltip = shouldShowTooltip(window);
|
||||
if (tooltip.isEmpty() && showTooltip) { // mouseover tip, not holding an item
|
||||
font = getFontRenderer(stack);
|
||||
@@ -958,11 +937,9 @@ public class GuiContainerManager {
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int k) {
|
||||
KeyManager.handleKeyEvent(k, () -> {
|
||||
if (firstKeyTyped(c, k)) return;
|
||||
if (firstKeyTyped(c, k)) return;
|
||||
|
||||
callKeyTyped(window, c, k);
|
||||
});
|
||||
callKeyTyped(window, c, k);
|
||||
}
|
||||
|
||||
private static void callKeyTyped(GuiContainer window, char c, int k) {
|
||||
|
||||
@@ -17,7 +17,6 @@ import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.recipe.stackinfo.GTFluidStackStringifyHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -47,8 +46,7 @@ public class ItemFluidDisplay extends Item implements IFluidContainerItem {
|
||||
}
|
||||
|
||||
public static ItemStack createStack(FluidStack fluidStack) {
|
||||
return fluidStack == null ? null
|
||||
: createStack(fluidStack.getFluid(), GTFluidStackStringifyHandler.getFluidAmount(fluidStack));
|
||||
return fluidStack == null ? null : createStack(fluidStack.getFluid(), fluidStack.amount);
|
||||
}
|
||||
|
||||
public static ItemStack createStack(Fluid fluid, long amount) {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class AutoCraftingManager {
|
||||
public void execute() {
|
||||
final GuiContainer guiContainer = NEIClientUtils.getGuiContainer();
|
||||
final ItemStack[] layout = snapshotLayout(guiContainer);
|
||||
final List<BookmarkItem> initialItems = prepareInitialItems(math, ItemStackAmount.of(guiContainer));
|
||||
final List<BookmarkItem> initialItems = prepareInitialItems(math, getInventoryItems(guiContainer));
|
||||
boolean processed = false;
|
||||
boolean changed = false;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class AutoCraftingManager {
|
||||
changed = false;
|
||||
|
||||
RecipeChainIterator iterator = new RecipeChainIterator(math, initialItems);
|
||||
iterator.updateInventory(ItemStackAmount.of(guiContainer));
|
||||
iterator.updateInventory(getInventoryItems(guiContainer));
|
||||
|
||||
while (iterator.hasNext() && !interrupted(guiContainer)) {
|
||||
final Map<RecipeId, Long> recipes = iterator.next();
|
||||
@@ -69,7 +69,7 @@ public class AutoCraftingManager {
|
||||
if (craft) {
|
||||
changed = true;
|
||||
processed = true;
|
||||
iterator.updateInventory(ItemStackAmount.of(guiContainer));
|
||||
iterator.updateInventory(getInventoryItems(guiContainer));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +138,18 @@ public class AutoCraftingManager {
|
||||
return AutoCraftingManager.math != null && !task.interrupted();
|
||||
}
|
||||
|
||||
public static ItemStackAmount getInventoryItems(GuiContainer guiContainer) {
|
||||
final ItemStackAmount inventory = new ItemStackAmount();
|
||||
|
||||
for (Slot slot : guiContainer.inventorySlots.inventorySlots) {
|
||||
if (slot.getHasStack() && !(slot instanceof SlotCrafting) && slot.canTakeStack(guiContainer.mc.thePlayer)) {
|
||||
inventory.add(slot.getStack());
|
||||
}
|
||||
}
|
||||
|
||||
return inventory;
|
||||
}
|
||||
|
||||
private static ItemStack[] snapshotLayout(GuiContainer guiContainer) {
|
||||
final List<Slot> slots = guiContainer.inventorySlots.inventorySlots;
|
||||
final ItemStack[] layout = new ItemStack[slots.size()];
|
||||
|
||||
@@ -487,11 +487,11 @@ public class Recipe {
|
||||
stack = getMainResult(getResults(), RecipeIngredient::getItemStack).getItemStack();
|
||||
}
|
||||
|
||||
long stackSize = 0;
|
||||
int stackSize = 0;
|
||||
|
||||
for (RecipeIngredient result : this.results) {
|
||||
if (result.contains(stack)) {
|
||||
stackSize += StackInfo.getAmountLong(result.getItemStack());
|
||||
stackSize += result.getAmount();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ public class RecipeItemsTooltipLineHandler extends CompositeTooltipLineHandler {
|
||||
}
|
||||
|
||||
if (screen instanceof GuiContainer container) {
|
||||
return ItemStackAmount.of(container);
|
||||
return AutoCraftingManager.getInventoryItems(container);
|
||||
}
|
||||
|
||||
return new ItemStackAmount();
|
||||
|
||||
@@ -29,6 +29,10 @@ import codechicken.nei.util.NBTHelper;
|
||||
|
||||
public class StackInfo {
|
||||
|
||||
/// Prefix of the MaterialLib reference form `ml:<MaterialName>:<shapeToken>`, which config entries carry in
|
||||
/// place of an id and metadata.
|
||||
public static final String MATERIALLIB_PREFIX = "ml:";
|
||||
|
||||
private static final FluidStack NULL_FLUID = new FluidStack(FluidRegistry.WATER, 0);
|
||||
public static final List<IStackStringifyHandler> stackStringifyHandlers = new ArrayList<>();
|
||||
private static final Map<String, HashMap<String, String[]>> guidfilters = new HashMap<>();
|
||||
@@ -121,13 +125,9 @@ public class StackInfo {
|
||||
}
|
||||
|
||||
public static int getAmount(ItemStack stack) {
|
||||
return (int) Math.min(getAmountLong(stack), Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public static long getAmountLong(ItemStack stack) {
|
||||
if (stack == null) return 0;
|
||||
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stack);
|
||||
return nbTag != null ? nbTag.getLong("Count") : 0;
|
||||
return nbTag != null ? nbTag.getInteger("Count") : 0;
|
||||
}
|
||||
|
||||
public static boolean equalItemAndNBT(ItemStack stackA, ItemStack stackB, boolean useNBT) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.bookmark.BookmarkItem;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.AutoCraftingManager;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.HandlerInfo;
|
||||
@@ -136,7 +137,7 @@ public class RecipeChainTooltipLineHandler extends CompositeTooltipLineHandler {
|
||||
final GuiContainer currentGui = NEIClientUtils.getGuiContainer();
|
||||
|
||||
if (this.lastShiftKey && currentGui != null && !(currentGui instanceof GuiRecipe<?>)) {
|
||||
inventory.putAll(ItemStackAmount.of(currentGui));
|
||||
inventory.putAll(AutoCraftingManager.getInventoryItems(currentGui));
|
||||
}
|
||||
|
||||
if (!this.outputRecipes.isEmpty()) {
|
||||
@@ -155,7 +156,7 @@ public class RecipeChainTooltipLineHandler extends CompositeTooltipLineHandler {
|
||||
for (ItemStack stack : items) {
|
||||
if (stack != null
|
||||
&& NEIClientUtils.areStacksSameTypeCraftingWithNBT(stack, item.itemStack)) {
|
||||
amount += StackInfo.getAmountLong(stack);
|
||||
amount += StackInfo.getAmount(stack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
|
||||
|
||||
protected static Class<?> itemFluidDisplay = null;
|
||||
protected static Method getFluidFromDisplayStack = null;
|
||||
private static Method getGTFluidAmount = null;
|
||||
protected static Class<?> gtMetaGeneratedTool = null;
|
||||
protected static Field playSound = null;
|
||||
|
||||
@@ -43,12 +42,6 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
|
||||
"gregtech.common.items.GT_FluidDisplayItem");
|
||||
getFluidFromDisplayStack = gtUtility.getMethod("getFluidFromDisplayStack", ItemStack.class);
|
||||
|
||||
try {
|
||||
getGTFluidAmount = gtUtility.getMethod("getFluidAmount", FluidStack.class);
|
||||
} catch (NoSuchMethodException ignored) {
|
||||
/* GregTech without long fluid stacks */
|
||||
}
|
||||
|
||||
gtMetaGeneratedTool = ReflectionHelper.getClass(
|
||||
loader,
|
||||
"gregtech.api.items.MetaGeneratedTool",
|
||||
@@ -59,18 +52,6 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
|
||||
}
|
||||
}
|
||||
|
||||
/** GregTech fluid stacks can hold more than {@link FluidStack#amount} does */
|
||||
public static long getFluidAmount(FluidStack fluidStack) {
|
||||
|
||||
if (getGTFluidAmount != null) {
|
||||
try {
|
||||
return (long) getGTFluidAmount.invoke(null, fluidStack);
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
return fluidStack.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound convertItemStackToNBT(ItemStack stack, boolean saveStackSize) {
|
||||
|
||||
@@ -80,7 +61,7 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
|
||||
if (fluidStack != null) {
|
||||
final NBTTagCompound nbTag = new NBTTagCompound();
|
||||
nbTag.setString(FluidDisplayStackStringifyHandler.NBT_FLUID_NAME, fluidStack.getFluid().getName());
|
||||
nbTag.setLong("Count", saveStackSize ? getFluidAmount(fluidStack) : 144);
|
||||
nbTag.setInteger("Count", saveStackSize ? fluidStack.amount : 144);
|
||||
return nbTag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package codechicken.nei.recipe.stackinfo;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.ruling_0.materiallib.api.StackResolver;
|
||||
|
||||
import codechicken.nei.api.IStackStringifyHandler;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
|
||||
/// Resolves config entries written in the MaterialLib reference form `ml:<MaterialName>:<shapeToken>` (see
|
||||
/// [StackInfo#MATERIALLIB_PREFIX]) through [StackResolver], so an entry keeps naming the same item across sessions
|
||||
/// that renumber item metadata. The resolved stack carries the metadata MaterialLib currently assigns, ignoring any
|
||||
/// `Damage` on the entry. Entries in any other form are left to the other handlers.
|
||||
///
|
||||
/// Registered only behind a `Loader.isModLoaded("materiallib")` gate, so this class never classloads without
|
||||
/// MaterialLib present.
|
||||
public class MaterialLibStackStringifyHandler implements IStackStringifyHandler {
|
||||
|
||||
@Override
|
||||
public ItemStack convertNBTToItemStack(NBTTagCompound nbtTag) {
|
||||
final String strId = nbtTag.getString("strId");
|
||||
|
||||
if (!strId.startsWith(StackInfo.MATERIALLIB_PREFIX)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final String[] parts = strId.split(":");
|
||||
|
||||
if (parts.length != 3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final ItemStack stack = StackResolver.getStack(parts[1], parts[2], nbtTag.getInteger("Count"));
|
||||
|
||||
if (stack != null && nbtTag.hasKey("tag")) {
|
||||
stack.setTagCompound((NBTTagCompound) nbtTag.getCompoundTag("tag").copy());
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -387,7 +387,7 @@ public class RecipeGroup {
|
||||
|
||||
protected boolean isSameStack(ItemStack stackA, ItemStack stackB) {
|
||||
return stackA == stackB || NEIServerUtils.areStacksSameType(stackA, stackB)
|
||||
&& StackInfo.getAmountLong(stackA) == StackInfo.getAmountLong(stackB);
|
||||
&& StackInfo.getAmount(stackA) == StackInfo.getAmount(stackB);
|
||||
}
|
||||
|
||||
protected List<ItemStack> getFilteredPermutations(int member, Point slotKey) {
|
||||
|
||||
Reference in new issue
Block a user