mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-21 20:52:11 +00:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
685477b381 | ||
|
|
28d653a3b5 | ||
|
|
34734a622b | ||
|
|
331a9fd638 | ||
|
|
98c49caff9 | ||
|
|
622b696389 | ||
|
|
985e1e0425 | ||
|
|
da05482ef0 | ||
|
|
b41c570315 | ||
|
|
0373e7376b | ||
|
|
178021a8e8 | ||
|
|
8dd9014109 |
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,13 +14,11 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -100,7 +98,8 @@ public class BookmarkPanel extends PanelWidget {
|
||||
ItemStackMetadata meta = topItemIndex >= 0 ? BGrid.metadata.get(topItemIndex) : null;
|
||||
|
||||
if (meta != null && meta.recipeId != null) {
|
||||
while (topItemIndex > 0 && meta.equalsRecipe(BGrid.metadata.get(topItemIndex - 1))) {
|
||||
while (topItemIndex > 0 && meta.groupId == BGrid.metadata.get(topItemIndex - 1).groupId
|
||||
&& meta.recipeId.equals(BGrid.metadata.get(topItemIndex - 1).recipeId)) {
|
||||
topItemIndex--;
|
||||
}
|
||||
|
||||
@@ -119,7 +118,8 @@ public class BookmarkPanel extends PanelWidget {
|
||||
if (meta != null && meta.recipeId != null) {
|
||||
int size = BGrid.size();
|
||||
|
||||
while (bottomItemIndex < size - 1 && meta.equalsRecipe(BGrid.metadata.get(bottomItemIndex + 1))) {
|
||||
while (bottomItemIndex < size - 1 && meta.groupId == BGrid.metadata.get(bottomItemIndex + 1).groupId
|
||||
&& meta.recipeId.equals(BGrid.metadata.get(bottomItemIndex + 1).recipeId)) {
|
||||
bottomItemIndex++;
|
||||
}
|
||||
|
||||
@@ -148,21 +148,9 @@ public class BookmarkPanel extends PanelWidget {
|
||||
this.fluidDisplay = fluidDisplay;
|
||||
}
|
||||
|
||||
public ItemStackMetadata(BookmarkRecipeId recipeId, NBTTagCompound nbTag, boolean ingredient, Integer groupId) {
|
||||
this(recipeId, nbTag.getInteger("Count"), ingredient, groupId, nbTag.hasKey("gtFluidName"));
|
||||
}
|
||||
|
||||
public ItemStackMetadata copy() {
|
||||
return new ItemStackMetadata(this.recipeId, this.factor, this.ingredient, this.groupId, this.fluidDisplay);
|
||||
}
|
||||
|
||||
public boolean equalsRecipe(ItemStackMetadata meta) {
|
||||
return equalsRecipe(meta.recipeId, meta.groupId);
|
||||
}
|
||||
|
||||
public boolean equalsRecipe(BookmarkRecipeId recipeId, int groupId) {
|
||||
return groupId == this.groupId && recipeId != null && recipeId.equals(this.recipeId);
|
||||
}
|
||||
}
|
||||
|
||||
public static enum BookmarkViewMode {
|
||||
@@ -175,26 +163,6 @@ public class BookmarkPanel extends PanelWidget {
|
||||
LOADED
|
||||
}
|
||||
|
||||
public static class BookmarkRecipe {
|
||||
|
||||
public String handlerName = "";
|
||||
public List<ItemStack> result = new ArrayList<>();
|
||||
public List<ItemStack> ingredients = new ArrayList<>();
|
||||
|
||||
public BookmarkRecipe(ItemStack... result) {
|
||||
this.result.addAll(Arrays.asList(result));
|
||||
}
|
||||
|
||||
public BookmarkRecipeId getRecipeId() {
|
||||
|
||||
if (!handlerName.isEmpty() && !ingredients.isEmpty()) {
|
||||
return new BookmarkRecipeId(handlerName, ingredients);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected static class BookmarkGroup {
|
||||
|
||||
public BookmarkCraftingChain crafting = null;
|
||||
@@ -639,7 +607,8 @@ public class BookmarkPanel extends PanelWidget {
|
||||
final ArrayList<Integer> items = new ArrayList<>();
|
||||
|
||||
for (int index = idx; index < size; index++) {
|
||||
if (meta.equalsRecipe(this.metadata.get(index))) {
|
||||
if (this.metadata.get(index).groupId == groupId
|
||||
&& meta.recipeId.equals(this.metadata.get(index).recipeId)) {
|
||||
sortingRank.put(index, (this.metadata.get(index).ingredient ? 1 : -1) * dir);
|
||||
items.add(index);
|
||||
}
|
||||
@@ -787,7 +756,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
final ItemStackMetadata meta = getMetadata(idx);
|
||||
if (meta.groupId == groupId
|
||||
&& (recipeId == null && meta.recipeId == null
|
||||
|| recipeId != null && recipeId.equals(meta.recipeId))
|
||||
|| recipeId != null && meta.recipeId != null && recipeId.equals(meta.recipeId))
|
||||
&& StackInfo.equalItemAndNBT(stackA, getItem(idx), true)) {
|
||||
return idx;
|
||||
}
|
||||
@@ -828,15 +797,9 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
protected void removeRecipe(int idx, boolean removeFullRecipe) {
|
||||
final ItemStackMetadata meta = this.metadata.get(idx);
|
||||
final ItemStackMetadata meta = getMetadata(idx);
|
||||
|
||||
if (!removeFullRecipe && meta.recipeId != null && !meta.ingredient) {
|
||||
final Optional<ItemStackMetadata> result = this.metadata.stream()
|
||||
.filter(m -> m != meta && !m.ingredient && meta.equalsRecipe(m)).findAny();
|
||||
removeFullRecipe = !result.isPresent();
|
||||
}
|
||||
|
||||
if (meta.recipeId != null && removeFullRecipe) {
|
||||
if (meta.recipeId != null && (removeFullRecipe || !meta.ingredient)) {
|
||||
removeRecipe(meta.recipeId, meta.groupId);
|
||||
} else {
|
||||
removeItem(idx);
|
||||
@@ -844,9 +807,12 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
protected void removeRecipe(BookmarkRecipeId recipeIdA, int groupId) {
|
||||
BookmarkRecipeId recipeIdB;
|
||||
|
||||
for (int slotIndex = metadata.size() - 1; slotIndex >= 0; slotIndex--) {
|
||||
if (metadata.get(slotIndex).equalsRecipe(recipeIdA, groupId)) {
|
||||
recipeIdB = metadata.get(slotIndex).recipeId;
|
||||
|
||||
if (recipeIdB != null && metadata.get(slotIndex).groupId == groupId && recipeIdB.equals(recipeIdA)) {
|
||||
removeItem(slotIndex);
|
||||
}
|
||||
}
|
||||
@@ -923,12 +889,14 @@ public class BookmarkPanel extends PanelWidget {
|
||||
drawRect(rect.x, rect.y, rect.w, rect.h, 0x9966CCFF); // exports
|
||||
}
|
||||
|
||||
} else if (focus != null && meta.equalsRecipe(getMetadata(focus.slotIndex))) {
|
||||
drawRect(rect.x, rect.y, rect.w, rect.h, meta.ingredient ? 0x6645DA75 : 0x9966CCFF); // highlight
|
||||
// recipe
|
||||
} else {
|
||||
super.beforeDrawSlot(focus, idx, rect);
|
||||
}
|
||||
} else if (focus != null && meta.recipeId != null
|
||||
&& meta.groupId == getMetadata(focus.slotIndex).groupId
|
||||
&& meta.recipeId.equals(this.getRecipeId(focus.slotIndex))) {
|
||||
drawRect(rect.x, rect.y, rect.w, rect.h, meta.ingredient ? 0x6645DA75 : 0x9966CCFF); // highlight
|
||||
// recipe
|
||||
} else {
|
||||
super.beforeDrawSlot(focus, idx, rect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -952,9 +920,11 @@ public class BookmarkPanel extends PanelWidget {
|
||||
if (groupMeta.crafting != null && meta.groupId == this.focusedGroupId
|
||||
&& groupMeta.crafting.multiplier.containsKey(stack)) {
|
||||
multiplier = this.groups.get(meta.groupId).crafting.multiplier.get(stack);
|
||||
} else if (focus != null && meta.factor > 0 && meta.equalsRecipe(getMetadata(focus.slotIndex))) {
|
||||
multiplier = StackInfo.itemStackToNBT(stack).getInteger("Count") / meta.factor;
|
||||
}
|
||||
} else if (focus != null && meta.factor > 0
|
||||
&& meta.groupId == this.metadata.get(focus.slotIndex).groupId
|
||||
&& meta.recipeId.equals(this.metadata.get(focus.slotIndex).recipeId)) {
|
||||
multiplier = StackInfo.itemStackToNBT(stack).getInteger("Count") / meta.factor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1249,7 +1219,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
addItem(itemStack, true);
|
||||
}
|
||||
|
||||
public void addItem(ItemStack itemStack, boolean saveSize) {
|
||||
public void addItem(ItemStack itemStack, boolean saveStackSize) {
|
||||
final BookmarkGrid BGrid = (BookmarkGrid) grid;
|
||||
int idx = BGrid.indexOf(itemStack, true);
|
||||
|
||||
@@ -1257,7 +1227,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
BGrid.removeItem(idx);
|
||||
}
|
||||
|
||||
addOrRemoveItem(itemStack, null, null, false, saveSize);
|
||||
addOrRemoveItem(itemStack, null, null, false, saveStackSize);
|
||||
}
|
||||
|
||||
public void addOrRemoveItem(ItemStack stackA) {
|
||||
@@ -1265,7 +1235,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
public void addOrRemoveItem(ItemStack stackover, final String handlerName, final List<PositionedStack> ingredients,
|
||||
boolean saveIngredients, boolean saveSize) {
|
||||
boolean saveIngredients, boolean saveStackSize) {
|
||||
loadBookmarksIfNeeded();
|
||||
|
||||
final Point mousePos = getMousePosition();
|
||||
@@ -1275,122 +1245,62 @@ public class BookmarkPanel extends PanelWidget {
|
||||
if (slot != null && StackInfo.equalItemAndNBT(slot.item, stackover, true)) {
|
||||
BGrid.removeRecipe(slot.slotIndex, saveIngredients);
|
||||
} else {
|
||||
final NBTTagCompound nbTagA = StackInfo.itemStackToNBT(stackover, saveStackSize);
|
||||
final ItemStack normalizedA = StackInfo.loadFromNBT(nbTagA, saveStackSize ? nbTagA.getInteger("Count") : 0);
|
||||
BookmarkRecipeId recipeId = null;
|
||||
|
||||
if (!handlerName.isEmpty() && ingredients != null) {
|
||||
if (handlerName != "" && ingredients != null) {
|
||||
recipeId = new BookmarkRecipeId(handlerName, ingredients);
|
||||
}
|
||||
|
||||
final int idx = BGrid.indexOf(stackover, recipeId);
|
||||
final int idx = BGrid.indexOf(normalizedA, recipeId);
|
||||
|
||||
if (idx != -1) {
|
||||
BGrid.removeRecipe(idx, saveIngredients);
|
||||
} else if (saveIngredients && !handlerName.isEmpty() && ingredients != null) {
|
||||
BookmarkRecipe recipe = new BookmarkRecipe(stackover);
|
||||
recipe.handlerName = handlerName;
|
||||
|
||||
for (PositionedStack stack : ingredients) {
|
||||
recipe.ingredients.add(stack.item);
|
||||
}
|
||||
|
||||
addRecipe(recipe, saveSize);
|
||||
} else {
|
||||
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stackover);
|
||||
final ItemStack normalized = StackInfo.loadFromNBT(nbTag, saveSize ? nbTag.getInteger("Count") : 0);
|
||||
final ItemStackMetadata metadata = new ItemStackMetadata(
|
||||
recipeId,
|
||||
nbTag,
|
||||
false,
|
||||
BookmarkGrid.DEFAULT_GROUP_ID);
|
||||
|
||||
BGrid.addItem(normalized, metadata);
|
||||
}
|
||||
}
|
||||
if (saveIngredients && handlerName != "" && ingredients != null) {
|
||||
final Map<String, Integer> ingredientCount = new HashMap<>();
|
||||
final Map<String, NBTTagCompound> uniqueIngredients = new LinkedHashMap<>();
|
||||
|
||||
fixCountOfNamespaces();
|
||||
saveBookmarks();
|
||||
}
|
||||
BGrid.removeRecipe(recipeId, BookmarkGrid.DEFAULT_GROUP_ID);
|
||||
|
||||
public void addRecipe(BookmarkRecipe recipe, boolean saveSize) {
|
||||
addRecipe(recipe, saveSize, BookmarkGrid.DEFAULT_GROUP_ID);
|
||||
}
|
||||
for (PositionedStack stack : ingredients) {
|
||||
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stack.item, saveStackSize);
|
||||
final String GUID = StackInfo.getItemStackGUID(stack.item);
|
||||
|
||||
public void addRecipe(BookmarkRecipe recipe, boolean saveSize, int groupId) {
|
||||
final BookmarkGrid BGrid = (BookmarkGrid) grid;
|
||||
final BookmarkRecipeId recipeId = recipe.getRecipeId();
|
||||
if (!uniqueIngredients.containsKey(GUID)) {
|
||||
ingredientCount.put(GUID, nbTag.getInteger("Count"));
|
||||
uniqueIngredients.put(GUID, nbTag);
|
||||
} else {
|
||||
ingredientCount.put(GUID, ingredientCount.get(GUID) + nbTag.getInteger("Count"));
|
||||
}
|
||||
|
||||
if (!BGrid.groups.containsKey(groupId)) {
|
||||
groupId = BookmarkGrid.DEFAULT_GROUP_ID;
|
||||
}
|
||||
}
|
||||
|
||||
if (recipeId != null) {
|
||||
final Map<String, NBTTagCompound> uniqueIngredients = new LinkedHashMap<>();
|
||||
|
||||
BGrid.removeRecipe(recipeId, groupId);
|
||||
|
||||
for (ItemStack stack : recipe.ingredients) {
|
||||
final String GUID = StackInfo.getItemStackGUID(stack);
|
||||
final NBTTagCompound nbTagU = uniqueIngredients.get(GUID);
|
||||
final NBTTagCompound nbTagS = StackInfo.itemStackToNBT(stack);
|
||||
|
||||
if (nbTagU == null) {
|
||||
uniqueIngredients.put(GUID, nbTagS);
|
||||
} else {
|
||||
nbTagU.setInteger("Count", nbTagU.getInteger("Count") + nbTagS.getInteger("Count"));
|
||||
for (String GUID : uniqueIngredients.keySet()) {
|
||||
BGrid.addItem(
|
||||
StackInfo.loadFromNBT(
|
||||
uniqueIngredients.get(GUID),
|
||||
saveStackSize ? ingredientCount.get(GUID) : 0),
|
||||
new ItemStackMetadata(
|
||||
recipeId != null ? recipeId.copy() : null,
|
||||
ingredientCount.get(GUID),
|
||||
true,
|
||||
BookmarkGrid.DEFAULT_GROUP_ID,
|
||||
uniqueIngredients.get(GUID).hasKey("gtFluidName")));
|
||||
}
|
||||
}
|
||||
|
||||
BGrid.addItem(
|
||||
normalizedA,
|
||||
new ItemStackMetadata(
|
||||
recipeId,
|
||||
nbTagA.getInteger("Count"),
|
||||
false,
|
||||
BookmarkGrid.DEFAULT_GROUP_ID,
|
||||
nbTagA.hasKey("gtFluidName")));
|
||||
}
|
||||
|
||||
for (String GUID : uniqueIngredients.keySet()) {
|
||||
final NBTTagCompound nbTag = uniqueIngredients.get(GUID);
|
||||
final ItemStack normalized = StackInfo.loadFromNBT(nbTag, saveSize ? nbTag.getInteger("Count") : 0);
|
||||
final ItemStackMetadata metadata = new ItemStackMetadata(recipeId.copy(), nbTag, true, groupId);
|
||||
|
||||
BGrid.addItem(normalized, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack stack : recipe.result) {
|
||||
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stack);
|
||||
final ItemStack normalized = StackInfo.loadFromNBT(nbTag, saveSize ? nbTag.getInteger("Count") : 0);
|
||||
final ItemStackMetadata metadata = new ItemStackMetadata(recipeId, nbTag, false, groupId);
|
||||
|
||||
BGrid.addItem(normalized, metadata);
|
||||
}
|
||||
|
||||
fixCountOfNamespaces();
|
||||
saveBookmarks();
|
||||
}
|
||||
|
||||
public void addBookmarkGroup(List<ItemStack> items, BookmarkViewMode viewMode) {
|
||||
List<BookmarkRecipe> recipes = new ArrayList<>();
|
||||
|
||||
for (ItemStack stack : items) {
|
||||
recipes.add(new BookmarkRecipe(stack));
|
||||
}
|
||||
|
||||
addBookmarkGroup(recipes, viewMode, false);
|
||||
}
|
||||
|
||||
public void addBookmarkGroup(List<BookmarkRecipe> recipes, BookmarkViewMode viewMode, boolean crafting) {
|
||||
if (recipes.isEmpty()) return;
|
||||
|
||||
final BookmarkGrid BGrid = (BookmarkGrid) grid;
|
||||
int groupId = BookmarkGrid.DEFAULT_GROUP_ID;
|
||||
|
||||
if (viewMode == null) {
|
||||
viewMode = BGrid.getViewMode(BookmarkGrid.DEFAULT_GROUP_ID);
|
||||
}
|
||||
|
||||
for (ItemStackMetadata meta : BGrid.metadata) {
|
||||
if (meta.groupId > groupId) {
|
||||
groupId = meta.groupId;
|
||||
}
|
||||
}
|
||||
|
||||
BGrid.groups.put(++groupId, new BookmarkGroup(viewMode, crafting));
|
||||
|
||||
for (BookmarkRecipe recipe : recipes) {
|
||||
addRecipe(recipe, true, groupId);
|
||||
}
|
||||
|
||||
fixCountOfNamespaces();
|
||||
@@ -1864,7 +1774,8 @@ public class BookmarkPanel extends PanelWidget {
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < BGrid.metadata.size(); i++) {
|
||||
if (meta.equalsRecipe(BGrid.getMetadata(i))) {
|
||||
if (BGrid.metadata.get(i).recipeId != null && meta.groupId == BGrid.metadata.get(i).groupId
|
||||
&& meta.recipeId.equals(BGrid.metadata.get(i).recipeId)) {
|
||||
items.add(BGrid.realItems.get(i));
|
||||
metadata.add(BGrid.metadata.get(i));
|
||||
}
|
||||
@@ -1911,7 +1822,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
} else if (ySlot <= 0.25) {
|
||||
|
||||
if (BGrid.getViewMode(beforeGroupId) == BookmarkViewMode.TODO_LIST
|
||||
&& !existsRecipeIdInGroupId(sortMeta.recipeId, beforeGroupId)) {
|
||||
&& !existsRecipeIdInGroupId(beforeGroupId, sortMeta.recipeId)) {
|
||||
BGrid.moveItem(this.sortableItem, mouseOverSlot.slotIndex, beforeGroupId, true);
|
||||
}
|
||||
|
||||
@@ -1921,12 +1832,12 @@ public class BookmarkPanel extends PanelWidget {
|
||||
&& (afterGroupId != BookmarkGrid.DEFAULT_GROUP_ID
|
||||
|| BGrid.getViewMode(overGroupId) == BookmarkViewMode.DEFAULT)
|
||||
&& BGrid.getViewMode(BookmarkGrid.DEFAULT_GROUP_ID) == BookmarkViewMode.TODO_LIST
|
||||
&& !existsRecipeIdInGroupId(sortMeta.recipeId, BookmarkGrid.DEFAULT_GROUP_ID)) {
|
||||
&& !existsRecipeIdInGroupId(BookmarkGrid.DEFAULT_GROUP_ID, sortMeta.recipeId)) {
|
||||
beforeGroupId = BookmarkGrid.DEFAULT_GROUP_ID;
|
||||
}
|
||||
|
||||
if (BGrid.getViewMode(beforeGroupId) == BookmarkViewMode.TODO_LIST
|
||||
&& !existsRecipeIdInGroupId(sortMeta.recipeId, beforeGroupId)) {
|
||||
&& !existsRecipeIdInGroupId(beforeGroupId, sortMeta.recipeId)) {
|
||||
BGrid.moveItem(this.sortableItem, mouseOverSlot.slotIndex, beforeGroupId, true);
|
||||
}
|
||||
|
||||
@@ -1937,12 +1848,12 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|| BGrid.getViewMode(overGroupId) == BookmarkViewMode.DEFAULT)
|
||||
&& afterGroupId != BookmarkGrid.DEFAULT_GROUP_ID
|
||||
&& BGrid.getViewMode(BookmarkGrid.DEFAULT_GROUP_ID) == BookmarkViewMode.TODO_LIST
|
||||
&& !existsRecipeIdInGroupId(sortMeta.recipeId, BookmarkGrid.DEFAULT_GROUP_ID)) {
|
||||
&& !existsRecipeIdInGroupId(BookmarkGrid.DEFAULT_GROUP_ID, sortMeta.recipeId)) {
|
||||
afterGroupId = BookmarkGrid.DEFAULT_GROUP_ID;
|
||||
}
|
||||
|
||||
if (BGrid.getViewMode(afterGroupId) == BookmarkViewMode.TODO_LIST
|
||||
&& !existsRecipeIdInGroupId(sortMeta.recipeId, afterGroupId)) {
|
||||
&& !existsRecipeIdInGroupId(afterGroupId, sortMeta.recipeId)) {
|
||||
BGrid.moveItem(
|
||||
this.sortableItem,
|
||||
BGrid.getRowItemIndex(overRowIndex, false),
|
||||
@@ -1953,7 +1864,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
} else if (ySlot >= 0.75) {
|
||||
|
||||
if (BGrid.getViewMode(afterGroupId) == BookmarkViewMode.TODO_LIST
|
||||
&& !existsRecipeIdInGroupId(sortMeta.recipeId, afterGroupId)) {
|
||||
&& !existsRecipeIdInGroupId(afterGroupId, sortMeta.recipeId)) {
|
||||
BGrid.moveItem(
|
||||
this.sortableItem,
|
||||
BGrid.getRowItemIndex(overRowIndex, false),
|
||||
@@ -1998,11 +1909,12 @@ public class BookmarkPanel extends PanelWidget {
|
||||
super.mouseDragged(mousex, mousey, button, heldTime);
|
||||
}
|
||||
|
||||
private boolean existsRecipeIdInGroupId(BookmarkRecipeId recipeId, int groupId) {
|
||||
private boolean existsRecipeIdInGroupId(int groupId, BookmarkRecipeId recipeId) {
|
||||
if (recipeId == null) return false;
|
||||
|
||||
for (ItemStackMetadata meta : ((BookmarkGrid) grid).metadata) {
|
||||
if (meta.equalsRecipe(recipeId, groupId) && this.sortableItem.metadata.indexOf(meta) == -1) {
|
||||
if (meta.groupId == groupId && this.sortableItem.metadata.indexOf(meta) == -1
|
||||
&& recipeId.equals(meta.recipeId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2165,12 +2077,18 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
if (NEIClientUtils.shiftKey()) {
|
||||
ItemStackMetadata ingrMeta;
|
||||
|
||||
for (int slotIndex = grid.size() - 1; slotIndex >= 0; slotIndex--) {
|
||||
if (overMeta.equalsRecipe(BGrid.getMetadata(slotIndex)) && slotIndex != slot.slotIndex) {
|
||||
ingrMeta = BGrid.getMetadata(slotIndex);
|
||||
|
||||
if (ingrMeta.recipeId != null && ingrMeta.groupId == overMeta.groupId
|
||||
&& ingrMeta.recipeId.equals(overMeta.recipeId)
|
||||
&& slotIndex != slot.slotIndex) {
|
||||
items.put(slotIndex, shiftStackSize(BGrid, slotIndex, shift, shiftMultiplier));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
items.put(slot.slotIndex, shiftStackSize(BGrid, slot.slotIndex, shift, shiftMultiplier));
|
||||
|
||||
@@ -235,7 +235,7 @@ public class SearchField extends TextField implements ItemFilterProvider {
|
||||
}
|
||||
|
||||
public static String getEscapedSearchText(ItemStack stack) {
|
||||
final FluidStack fluidStack = StackInfo.isFluidContainer(stack) ? null : StackInfo.getFluid(stack);
|
||||
final FluidStack fluidStack = StackInfo.getFluid(stack);
|
||||
String displayName;
|
||||
|
||||
if (fluidStack != null) {
|
||||
|
||||
@@ -65,17 +65,12 @@ public class SearchTokenParser {
|
||||
|
||||
private static class ProvidersCache {
|
||||
|
||||
public String languageCode = null;
|
||||
public List<ISearchParserProvider> providers = new ArrayList<>();
|
||||
|
||||
public void clear() {
|
||||
this.languageCode = null;
|
||||
this.providers.clear();
|
||||
}
|
||||
protected String languageCode = null;
|
||||
protected List<ISearchParserProvider> providers;
|
||||
}
|
||||
|
||||
protected final List<ISearchParserProvider> searchProviders;
|
||||
protected final ProvidersCache providersCache = new ProvidersCache();
|
||||
protected ProvidersCache providersCache = new ProvidersCache();
|
||||
|
||||
public SearchTokenParser(List<ISearchParserProvider> searchProviders) {
|
||||
this.searchProviders = searchProviders;
|
||||
@@ -87,7 +82,6 @@ public class SearchTokenParser {
|
||||
|
||||
public void addProvider(ISearchParserProvider provider) {
|
||||
this.searchProviders.add(provider);
|
||||
this.providersCache.clear();
|
||||
}
|
||||
|
||||
protected List<ISearchParserProvider> getProviders() {
|
||||
@@ -99,7 +93,7 @@ public class SearchTokenParser {
|
||||
for (int index = this.searchProviders.size() - 1; index >= 0; index--) {
|
||||
ISearchParserProvider provider = this.searchProviders.get(index);
|
||||
|
||||
if (!providers.containsKey(provider.getPrefix())
|
||||
if (!providers.containsKey(provider.getPrefix()) && provider.getSearchMode() != SearchMode.NEVER
|
||||
&& provider.getMatchingLanguages().contains(currentLanguage)) {
|
||||
providers.put(provider.getPrefix(), provider);
|
||||
}
|
||||
@@ -113,9 +107,7 @@ public class SearchTokenParser {
|
||||
}
|
||||
|
||||
public ISearchParserProvider getProvider(char ch) {
|
||||
return getProviders().stream()
|
||||
.filter(provider -> provider.getSearchMode() == SearchMode.PREFIX && provider.getPrefix() == ch)
|
||||
.findFirst().orElse(null);
|
||||
return getProviders().stream().filter(provider -> provider.getPrefix() == ch).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public ItemFilter getFilter(String filterText) {
|
||||
|
||||
@@ -197,7 +197,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
public void randomRenderPermutation(List<PositionedStack> stacks, long cycle) {
|
||||
protected void randomRenderPermutation(List<PositionedStack> stacks, long cycle) {
|
||||
final ItemFilter filter = getItemFilter();
|
||||
final int randCycle = Math.abs(new Random(cycle + offset).nextInt());
|
||||
|
||||
@@ -228,7 +228,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void randomRenderPermutation(PositionedStack stack, long cycle) {
|
||||
protected void randomRenderPermutation(PositionedStack stack, long cycle) {
|
||||
Random rand = new Random(cycle + offset);
|
||||
stack.setPermutationToRender((int) (Math.abs(rand.nextInt()) % stack.items.length));
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ import net.minecraft.item.ItemStack;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
|
||||
@@ -23,16 +21,7 @@ public class ModNameFilter implements ItemFilter {
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack itemStack) {
|
||||
return this.pattern.matcher(nameFromStack(itemStack.getItem())).find();
|
||||
}
|
||||
|
||||
protected static String nameFromStack(Item item) {
|
||||
try {
|
||||
ModContainer mod = Loader.instance().getIndexedModList().get(getModId(item));
|
||||
return mod == null ? "Minecraft" : mod.getName();
|
||||
} catch (NullPointerException e) {
|
||||
return "";
|
||||
}
|
||||
return this.pattern.matcher(getModId(itemStack.getItem())).find();
|
||||
}
|
||||
|
||||
protected static String getModId(Item item) {
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TooltipFilter implements ItemFilter {
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack itemStack) {
|
||||
return pattern.matcher(getSearchTooltip(itemStack)).find();
|
||||
return pattern.matcher(getSearchName(itemStack)).find();
|
||||
}
|
||||
|
||||
public static void populateSearchMap() {
|
||||
@@ -68,7 +68,7 @@ public class TooltipFilter implements ItemFilter {
|
||||
itemSearchNames.keySet().removeAll(oldItems);
|
||||
}
|
||||
|
||||
protected static String getSearchTooltip(ItemStack stack) {
|
||||
protected static String getSearchName(ItemStack stack) {
|
||||
return itemSearchNames.computeIfAbsent(new ItemStackKey(stack), key -> getTooltip(key.stack));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user