Compare commits

...
Author SHA1 Message Date
Martin Robertz 064f31f8db update gradle+bs+deps 2023-12-03 17:10:11 +01:00
slprimeandslprime 9b081ed2a7 fix bookmarks Infinite loop in todo list (#442)
Co-authored-by: slprime <[email protected]>
2023-12-03 17:07:54 +01:00
miozune 2fc2ecf082 Suppress warning for recipe catalyst item from config not being found (#441) 2023-11-09 18:38:50 +09:00
miozune bc7efcfce5 Improve the way catalyst info is loaded via API (#434) 2023-11-08 18:34:14 +09:00
miozune 0c5af2b892 Add method to directly set DrawableResource for HandlerInfo builder (#440) 2023-11-08 18:03:42 +09:00
Martin Robertz 0c61e559ec update bs 2023-11-08 08:19:08 +01:00
miozune b94bd11e64 Move handler info load to LoadCompleteEvent (#439) 2023-11-07 22:44:13 +09:00
miozune 151a9957de Add another method for handler info event (#438) 2023-11-07 22:44:04 +09:00
Nico Spiske b011024164 Fix TiCo Crafting Stations not working with compressed chests (#435)
* [major] fixes compressed chests not working with the tico crafting station

* [minor] comply with review + bs
2023-11-03 17:19:51 +09:00
13 changed files with 102 additions and 62 deletions

No files matched your search

+7 -23
View File
@@ -1,4 +1,4 @@
//version: 1697697256
//version: 1701530445
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -28,27 +28,12 @@ import java.util.concurrent.TimeUnit
buildscript {
repositories {
mavenCentral()
maven {
name 'forge'
url 'https://maven.minecraftforge.net'
}
maven {
// GTNH RetroFuturaGradle and ASM Fork
name "GTNH Maven"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
}
maven {
name 'sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
name 'Scala CI dependencies'
url 'https://repo1.maven.org/maven2/'
}
mavenLocal()
}
}
@@ -302,7 +287,7 @@ if (apiPackage) {
}
if (accessTransformersFile) {
for (atFile in accessTransformersFile.split(",")) {
for (atFile in accessTransformersFile.split(" ")) {
String targetFile = "src/main/resources/META-INF/" + atFile.trim()
if (!getFile(targetFile).exists()) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
@@ -646,7 +631,7 @@ repositories {
def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.7.1"
def mixinProviderVersion = "0.1.13"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
ext.mixinProviderSpec = mixinProviderSpec
@@ -793,12 +778,12 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
}
dependencies {
def lwjgl3ifyVersion = '1.5.1'
def lwjgl3ifyVersion = '1.5.7'
if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.17')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.35')
}
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
@@ -1187,9 +1172,8 @@ publishing {
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
}
}
repositories {
if (usesMavenPublishing.toBoolean()) {
if (usesMavenPublishing.toBoolean() && System.getenv("MAVEN_USER") != null) {
maven {
url = mavenPublishUrl
allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven
@@ -1311,7 +1295,7 @@ def addCurseForgeRelation(String type, String name) {
// Updating
def buildscriptGradleVersion = "8.2.1"
def buildscriptGradleVersion = "8.5"
tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion
+2 -2
View File
@@ -1,7 +1,7 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:CodeChickenLib:1.1.8:dev')
api('com.github.GTNewHorizons:CodeChickenCore:1.1.11:dev')
api('com.github.GTNewHorizons:CodeChickenLib:1.1.10:dev')
api('com.github.GTNewHorizons:CodeChickenCore:1.1.13:dev')
shadowImplementation('org.apache.commons:commons-csv:1.10.0')
}
Binary file not shown.
+2 -1
View File
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+4 -1
View File
@@ -130,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@@ -177,29 +177,43 @@ public class BookmarkPanel extends PanelWidget {
}
BookmarkStackMeta meta;
boolean isFirstColumn = false;
boolean isIngredient = false;
int size = size();
int idx = 0;
while (idx < size) {
ArrayList<Integer> pmask = new ArrayList<>();
int lastIdx = idx;
for (int i = 0, perPage = rows * columns; i < perPage && idx < size; i++) {
if (isInvalidSlot(i)) {
pmask.add(null);
} else {
meta = getMetadata(idx);
isFirstColumn = (i % columns) == 0;
isIngredient = meta.recipeId != null && meta.ingredient;
if (idx > 0 && ((i % columns) == 0) == (meta.recipeId != null && meta.ingredient
&& meta.recipeId.equals(getRecipeId(idx - 1)))) {
pmask.add(null);
} else {
if (isFirstColumn && !isIngredient) {
pmask.add(idx++);
if ((i % columns) == 0) {
todoItemsCount++;
}
todoItemsCount++;
} else if (isIngredient && (!isFirstColumn || i + 1 < perPage && isInvalidSlot(i + 1))) {
// The ingredients that do not fit on the first line are moved to the second starting with
// the second column. This condition checks whether the second column is available. If not
// available, the ingredient takes the first column
pmask.add(idx++);
} else {
pmask.add(null);
}
}
}
if (lastIdx == idx) {
break;
}
gridMask.add(pmask);
@@ -476,7 +476,6 @@ public class NEIClientConfig {
RecipeInfo.load();
LayoutManager.load();
NEIController.load();
RecipeCatalysts.loadCatalystInfo();
BookmarkContainerInfo.load();
mainNEIConfigLoaded = true;
@@ -502,6 +501,8 @@ public class NEIClientConfig {
}
}
RecipeCatalysts.loadCatalystInfo();
// Set pluginNEIConfigLoaded here before posting the NEIConfigsLoadedEvent. This used to be the other
// way around, but apparently if your modpack includes 800 mods the event poster might not return in
// time and cause issues when loading a world for a second time as configLoaded is still false. This may
@@ -26,6 +26,7 @@ import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.versioning.ArtifactVersion;
@@ -118,11 +119,17 @@ public class NEIModContainer extends DummyModContainer {
@Subscribe
public void postInit(FMLPostInitializationEvent event) {
if (CommonUtils.isClient()) {
GuiRecipeTab.loadHandlerInfo();
ClientHandler.postInit();
}
}
@Subscribe
public void loadComplete(FMLLoadCompleteEvent event) {
if (CommonUtils.isClient()) {
GuiRecipeTab.loadHandlerInfo();
}
}
@Subscribe
public void handleIMCMessages(FMLInterModComms.IMCEvent event) {
IMCHandler.processIMC(event.getMessages());
@@ -12,20 +12,15 @@ import cpw.mods.fml.common.eventhandler.Event;
/**
* Event is posted every time the handler infos got registered or reloaded. During it, you can safely register your
* custom handler info.
*
* <br>
* This event does not have a result. {@link HasResult}<br>
* custom handler info. <br>
* This event does not have {@link HasResult result}.<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
*/
@SuppressWarnings("unused")
public class NEIRegisterHandlerInfosEvent extends Event {
public void registerHandlerInfo(String handlerName, String modName, String modId,
Consumer<HandlerInfo.Builder> builder) {
HandlerInfo.Builder b = new HandlerInfo.Builder(handlerName, modName, modId);
builder.accept(b);
HandlerInfo info = b.build();
public void registerHandlerInfo(HandlerInfo info) {
if (GuiRecipeTab.handlerMap.put(info.getHandlerName(), info) != null) {
NEIClientConfig.logger.info("Replaced handler info for {}", info.getHandlerName());
} else {
@@ -33,6 +28,14 @@ public class NEIRegisterHandlerInfosEvent extends Event {
}
}
public void registerHandlerInfo(String handlerName, String modName, String modId,
Consumer<HandlerInfo.Builder> builder) {
HandlerInfo.Builder b = new HandlerInfo.Builder(handlerName, modName, modId);
builder.accept(b);
HandlerInfo info = b.build();
registerHandlerInfo(info);
}
public void registerHandlerInfo(Class<? extends IRecipeHandler> handlerClazz, String modName, String modId,
Consumer<HandlerInfo.Builder> builder) {
registerHandlerInfo(handlerClazz.getName(), modName, modId, builder);
@@ -10,10 +10,8 @@ import net.minecraft.item.ItemStack;
import com.google.common.collect.ForwardingList;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIServerUtils;
// Do not directly extend ArrayList, see Effective Java Item 16
public class CatalystInfoList extends ForwardingList<CatalystInfo> {
private final String handlerID;
@@ -34,16 +32,21 @@ public class CatalystInfoList extends ForwardingList<CatalystInfo> {
}
@Override
public boolean add(@Nonnull CatalystInfo catalystInfo) {
if (contains(catalystInfo)) {
NEIClientConfig.logger.info(
String.format(
"catalyst %s is already registered to handler %s",
catalystInfo.getStack().getDisplayName(),
handlerID));
return false;
public boolean add(@Nonnull CatalystInfo element) {
return doAdd(element);
}
public boolean add(@Nonnull CatalystInfo catalystInfo, boolean overwrite) {
if (overwrite || !contains(catalystInfo)) {
return add(catalystInfo);
}
super.add(catalystInfo);
return false;
}
private boolean doAdd(@Nonnull CatalystInfo catalystInfo) {
catalystInfoList
.removeIf(c -> NEIServerUtils.areStacksSameTypeCraftingWithNBT(c.getStack(), catalystInfo.getStack()));
catalystInfoList.add(catalystInfo);
return true;
}
@@ -118,8 +118,8 @@ public class DefaultOverlayHandler implements IOverlayHandler {
ItemStack stack = slot.getStack();
if (!canStack(stack, pstack)) continue;
FastTransferManager.clickSlot(gui, slot.slotNumber);
int amount = Math.min(transferCap - transferred, stack.stackSize);
FastTransferManager.clickSlot(gui, slot.slotNumber);
for (int c = 0; c < amount; c++) {
FastTransferManager.clickSlot(gui, dest.slotNumber, 1);
transferred++;
@@ -131,6 +131,12 @@ public class HandlerInfo {
return this;
}
public Builder setDisplayImage(DrawableResource drawable) {
info.itemStack = null;
info.image = drawable;
return this;
}
public Builder setDisplayImage(ResourceLocation location, int imageX, int imageY, int imageWidth,
int imageHeight) {
info.itemStack = null;
@@ -132,6 +132,8 @@ public class RecipeCatalysts {
recipeCatalystMap.clear();
URL handlerUrl = RecipeCatalysts.class.getResource("/assets/nei/csv/catalysts.csv");
resolveAdderQueue();
URL url;
if (fromJar) {
url = handlerUrl;
@@ -183,7 +185,7 @@ public class RecipeCatalysts {
if (itemName == null || itemName.isEmpty()) continue;
ItemStack stack = NEIServerUtils.getModdedItem(itemName, record.get("nbtInfo"));
if (stack == null) {
NEIClientConfig.logger.warn("Couldn't find ItemStack " + itemName);
NEIClientConfig.logger.debug("Couldn't find ItemStack " + itemName);
continue;
}
CatalystInfo catalystInfo = new CatalystInfo(stack, priority);
@@ -208,13 +210,23 @@ public class RecipeCatalysts {
handlerID = handler;
}
addOrPut(recipeCatalystMap, handlerID, catalystInfo);
// Prefer info added by API if we're using default jar config.
// If not, user config overwrites it.
addOrPut(recipeCatalystMap, handlerID, catalystInfo, !fromJar);
}
} catch (Exception e) {
NEIClientConfig.logger.warn("Error parsing CSV");
e.printStackTrace();
}
if (fromJar) {
resolveRemoverQueue();
}
updatePosition(getHeight(), true);
}
private static void resolveAdderQueue() {
for (Map.Entry<String, CatalystInfoList> entry : catalystsAdderFromAPI.entrySet()) {
String handlerID = entry.getKey();
for (CatalystInfo catalyst : entry.getValue()) {
@@ -243,6 +255,9 @@ public class RecipeCatalysts {
}
});
}
}
private static void resolveRemoverQueue() {
for (Map.Entry<String, List<ItemStack>> entry : catalystsRemoverFromAPI.entrySet()) {
String handlerID = entry.getKey();
if (recipeCatalystMap.containsKey(handlerID)) {
@@ -258,8 +273,6 @@ public class RecipeCatalysts {
entry.getValue().forEach(catalysts::remove);
}
}
updatePosition(getHeight(), true);
}
/**
@@ -275,8 +288,13 @@ public class RecipeCatalysts {
}
public static void addOrPut(Map<String, CatalystInfoList> map, String handlerID, CatalystInfo catalyst) {
addOrPut(map, handlerID, catalyst, false);
}
public static void addOrPut(Map<String, CatalystInfoList> map, String handlerID, CatalystInfo catalyst,
boolean overwrite) {
if (map.containsKey(handlerID)) {
map.get(handlerID).add(catalyst);
map.get(handlerID).add(catalyst, overwrite);
} else {
map.put(handlerID, new CatalystInfoList(handlerID, catalyst));
}