Compare commits

...
7 changed files with 76 additions and 59 deletions

No files matched your search

+23 -4
View File
@@ -1,4 +1,4 @@
//version: 1704751096
//version: 1705357285
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -122,6 +122,7 @@ propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
propertyDefaultIfUnset("curseForgeRelations", "")
propertyDefaultIfUnset("versionPattern", "")
propertyDefaultIfUnset("minimizeShadowedDependencies", true)
propertyDefaultIfUnset("relocateShadowedDependencies", true)
// Deprecated properties (kept for backwards compat)
@@ -370,6 +371,7 @@ catch (Exception ignored) {
// Pulls version first from the VERSION env and then git tag
String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null
boolean checkVersion = false
try {
// Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty
if (versionOverride == null) {
@@ -388,6 +390,8 @@ try {
}
} else if (isDirty) {
identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty"
} else {
checkVersion = true
}
} else {
identifiedVersion = versionOverride
@@ -409,6 +413,8 @@ ext {
if (identifiedVersion == versionOverride) {
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
} else if (checkVersion && versionPattern && !(identifiedVersion ==~ versionPattern)) {
throw new GradleException("Invalid version: '$identifiedVersion' does not match version pattern '$versionPattern'")
}
group = "com.github.GTNewHorizons"
@@ -428,18 +434,31 @@ minecraft {
for (f in replaceGradleTokenInFile.split(',')) {
tagReplacementFiles.add f
}
out.style(Style.Info).text('replaceGradleTokenInFile is deprecated! Consider using generateGradleTokenClass.').println()
}
if (gradleTokenModId) {
injectedTags.put gradleTokenModId, modId
if (replaceGradleTokenInFile) {
injectedTags.put gradleTokenModId, modId
} else {
out.style(Style.Failure).text('gradleTokenModId is deprecated! The field will no longer be generated.').println()
}
}
if (gradleTokenModName) {
injectedTags.put gradleTokenModName, modName
if (replaceGradleTokenInFile) {
injectedTags.put gradleTokenModName, modName
} else {
out.style(Style.Failure).text('gradleTokenModName is deprecated! The field will no longer be generated.').println()
}
}
if (gradleTokenVersion) {
injectedTags.put gradleTokenVersion, modVersion
}
if (gradleTokenGroupName) {
injectedTags.put gradleTokenGroupName, modGroup
if (replaceGradleTokenInFile) {
injectedTags.put gradleTokenGroupName, modGroup
} else {
out.style(Style.Failure).text('gradleTokenGroupName is deprecated! The field will no longer be generated.').println()
}
}
if (enableGenericInjection.toBoolean()) {
injectMissingGenerics.set(true)
+3 -3
View File
@@ -28,10 +28,10 @@ developmentEnvironmentUserName = Developer
# Leave these properties empty to skip individual token replacements
# Generate a class with String fields for the mod id, name, version and group name named with the fields below
generateGradleTokenClass = codechicken.nei.Tags
gradleTokenModId = MODID
gradleTokenModName = MODNAME
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = VERSION
gradleTokenGroupName = GROUPNAME
gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
@@ -269,27 +269,23 @@ public class BookmarkCraftingChain {
return false;
}
int shift = 0;
int minRecipeIndex = 0;
int minShift = 0x7fffff;
int minShift = Integer.MAX_VALUE;
for (CraftingChainItem item : request.outputs.get(stackIndex)) {
if (!request.initialItems.contains(item.recipeIndex) && item.factor > 0) {
long ingrCount = calculateCount(request, request.inputs.get(item.stackIndex));
long outputCount = calculateCount(request, request.outputs.get(item.stackIndex));
long shift = (ingrCount - outputCount) / item.factor;
while ((outputCount + item.factor * shift) < ingrCount && shift < minShift) {
shift++;
}
if (shift < minShift) {
minShift = shift;
if (shift > 0 && shift < minShift) {
minShift = (int) shift;
minRecipeIndex = item.recipeIndex;
}
}
}
if (minShift < 0x7fffff) {
if (minShift < Integer.MAX_VALUE) {
request.multiplier.put(minRecipeIndex, request.multiplier.get(minRecipeIndex) + minShift);
return true;
}
@@ -1285,12 +1285,21 @@ public class BookmarkPanel extends PanelWidget {
return null;
}
protected int getHoveredGroupId() {
public int getHoveredGroupId(boolean groupPanel) {
final BookmarkGrid BGrid = (BookmarkGrid) grid;
final int overRowIndex = BGrid.getHoveredRowIndex(true);
final int overRowIndex = BGrid.getHoveredRowIndex(groupPanel);
return overRowIndex >= 0 ? BGrid.getRowGroupId(overRowIndex) : -1;
}
public void removeGroup(int groupId) {
final BookmarkGrid BGrid = (BookmarkGrid) grid;
if (groupId >= 0 || groupId < BGrid.groups.size()) {
BGrid.removeGroup(groupId);
saveBookmarks();
}
}
protected String getNamespaceLabelText(boolean shortFormat) {
String activePage = String.valueOf(activeNamespaceIndex + 1);
@@ -1951,39 +1960,13 @@ public class BookmarkPanel extends PanelWidget {
return super.handleTooltip(mx, my, tooltip);
}
@Override
public boolean handleKeyPress(int keyID, char keyChar) {
if (NEIClientConfig.isKeyHashDown("gui.bookmark_pull_items")) {
return this.pullBookmarkItems(this.getHoveredGroupId(), false);
}
if (NEIClientConfig.isKeyHashDown("gui.bookmark_pull_items_ingredients")) {
return this.pullBookmarkItems(this.getHoveredGroupId(), true);
}
if (NEIClientConfig.isKeyHashDown("gui.bookmark_recipe")) {
final BookmarkGrid BGrid = (BookmarkGrid) grid;
final int overRowIndex = BGrid.getHoveredRowIndex(true);
if (overRowIndex >= 0) {
BGrid.removeGroup(BGrid.getRowGroupId(overRowIndex));
saveBookmarks();
return true;
}
}
return super.handleKeyPress(keyID, keyChar);
}
@Override
public void mouseUp(int mousex, int mousey, int button) {
if (this.sortableItem != null) {
this.sortableItem = null;
this.mouseDownSlot = -1;
grid.onGridChanged(); /* make sure grid redraws the new item */
grid.onItemsChanged(); /* make sure grid redraws the new item */
saveBookmarks();
} else if (this.groupingItem != null) {
final BookmarkGrid BGrid = (BookmarkGrid) grid;
@@ -2092,7 +2075,7 @@ public class BookmarkPanel extends PanelWidget {
* meta.factor;
if (count <= Integer.MAX_VALUE) {
return StackInfo.loadFromNBT(nbTag, Math.max((int) count, 0));
return StackInfo.loadFromNBT(nbTag, Math.max(count, 0));
}
}
@@ -2109,12 +2092,10 @@ public class BookmarkPanel extends PanelWidget {
final BookmarkGrid BGrid = (BookmarkGrid) grid;
final ArrayList<ItemStack> items = new ArrayList<>();
final ItemStackMap<Integer> uniqueItems = new ItemStackMap<>();
final ItemStackMap<Long> uniqueItems = new ItemStackMap<>();
final BookmarkGroup group = groupId >= 0 ? BGrid.groups.get(groupId) : null;
ItemStackMetadata meta;
System.out.println("onlyIngredients: " + onlyIngredients);
for (int idx = 0; idx < BGrid.realItems.size(); idx++) {
meta = BGrid.metadata.get(idx);
@@ -2123,16 +2104,21 @@ public class BookmarkPanel extends PanelWidget {
if (!onlyIngredients || meta.ingredient && (group == null || group.crafting == null
|| group.crafting.inputs.containsKey(BGrid.realItems.get(idx)))) {
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stack);
uniqueItems.put(stack, uniqueItems.getOrDefault(stack, 0) + nbTag.getInteger("Count"));
uniqueItems.put(
stack,
uniqueItems.getOrDefault(stack, 0L) + StackInfo.itemStackToNBT(stack).getInteger("Count"));
}
}
}
for (ItemStackMap.Entry<Integer> entry : uniqueItems.entries()) {
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(entry.key);
items.add(StackInfo.loadFromNBT(nbTag, entry.value));
for (ItemStackMap.Entry<Long> entry : uniqueItems.entries()) {
if (entry.value > 0) {
items.add(
StackInfo.loadFromNBT(
StackInfo.itemStackToNBT(entry.key),
Math.min(entry.value, 9 * 4 * entry.key.getMaxStackSize())));
}
}
if (items.isEmpty()) {
@@ -35,6 +35,23 @@ public abstract class ShortcutInputHandler {
return hideOverlayRecipe();
}
if (NEIClientConfig.isKeyHashDown("gui.bookmark_pull_items")) {
return ItemPanels.bookmarkPanel.pullBookmarkItems(ItemPanels.bookmarkPanel.getHoveredGroupId(true), false);
}
if (NEIClientConfig.isKeyHashDown("gui.bookmark_pull_items_ingredients")) {
return ItemPanels.bookmarkPanel.pullBookmarkItems(ItemPanels.bookmarkPanel.getHoveredGroupId(true), true);
}
if (stackover == null && NEIClientConfig.isKeyHashDown("gui.bookmark_recipe")) {
final int groupId = ItemPanels.bookmarkPanel.getHoveredGroupId(true);
if (groupId != -1) {
ItemPanels.bookmarkPanel.removeGroup(groupId);
return true;
}
}
if (stackover == null) {
return false;
}
@@ -12,8 +12,6 @@ import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import com.google.common.base.Objects;
import codechicken.core.TaskProfiler;
import codechicken.nei.ItemList;
import codechicken.nei.NEIClientConfig;
@@ -91,8 +89,9 @@ class RecipeHandlerQuery<T extends IRecipeHandler> {
}
private boolean isHidden(T handler) {
final String handlerId = Objects.firstNonNull(handler.getOverlayIdentifier(), handler.getHandlerId());
return NEIClientConfig.hiddenHandlers.stream().anyMatch(h -> h.equals(handlerId));
final String handlerName = handler.getHandlerId();
final String handlerId = handler.getOverlayIdentifier();
return NEIClientConfig.hiddenHandlers.stream().anyMatch(h -> h.equals(handlerId) || h.equals(handlerName));
}
private void printLog(Throwable t) {
@@ -64,7 +64,7 @@ public class StackInfo {
if (nbtTag != null) {
nbtTag = (NBTTagCompound) nbtTag.copy();
nbtTag.setInteger("Count", Math.max(customCount <= Integer.MAX_VALUE ? (int) customCount : 0, 0));
nbtTag.setInteger("Count", (int) Math.max(Math.min(customCount, Integer.MAX_VALUE), 0));
return loadFromNBT(nbtTag);
}