mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-17 11:05:07 +00:00
Compare commits
25
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09822a0a0f | ||
|
|
8693578a48 | ||
|
|
2d5c6e7ea4 | ||
|
|
335c70d4bb | ||
|
|
342d758a41 | ||
|
|
4cc34e9863 | ||
|
|
82e58c4eb5 | ||
|
|
13e9f3c547 | ||
|
|
df6bc4522a | ||
|
|
ddf1239583 | ||
|
|
48480504af | ||
|
|
f8c814b9e3 | ||
|
|
0ab857fef7 | ||
|
|
b87aab297f | ||
|
|
7b349bcf24 | ||
|
|
b32095a901 | ||
|
|
04dd2bd279 | ||
|
|
405bb35495 | ||
|
|
368018c2b1 | ||
|
|
12cc231224 | ||
|
|
7612571e97 | ||
|
|
c7c82407ef | ||
|
|
d90fcdc40c | ||
|
|
edc0e689b1 | ||
|
|
dff048466b |
No files matched your search
+2
-9
@@ -1,7 +1,6 @@
|
||||
.gradle
|
||||
.settings
|
||||
/.idea/
|
||||
/.vscode/
|
||||
/run/
|
||||
/build/
|
||||
/eclipse/
|
||||
@@ -26,12 +25,6 @@ whitelist.json
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
src/main/resources/mixins.*([!.]).json
|
||||
src/main/resources/mixins.*.json
|
||||
*.bat
|
||||
*.DS_Store
|
||||
!gradlew.bat
|
||||
.factorypath
|
||||
addon.local.gradle
|
||||
addon.local.gradle.kts
|
||||
addon.late.local.gradle
|
||||
addon.late.local.gradle.kts
|
||||
.DS_Store
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
A continuation of NotEnoughItems for 1.7.10 by the developers of Gregtech: New Horizons modpack, with features either inspired and/or backported from JustEnoughItems
|
||||
|
||||
We've tested this against all of the mods included in GTNH, as well as a limited set of other mods (like Reika's mods). Every effort has been made to maintain backwards compatibility, however the focus is on the mods contained in the GTNH modpack.
|
||||
We've tested this against all the mods included in GTNH, as well as a limited set of other mods (like Reika's mods). Every effort has been made to maintain backwards compatibility, however the focus is on the mods contained in the GTNH modpack.
|
||||
|
||||
If you have issues with NEI outside of the GTNH modpack you may report them in the [GTNH NEI GitHub](https://github.com/GTNewHorizons/NotEnoughItems).
|
||||
If you have issues with NEI outside the GTNH modpack, please report them in the [GTNH NEI GitHub](https://github.com/GTNewHorizons/NotEnoughItems).
|
||||
|
||||
## New Features:
|
||||
## Changes in this fork
|
||||
|
||||
### New Features:
|
||||
|
||||
* Speed
|
||||
- Uses a parallel stream to search the item list over multiple cores, resulting in 2-6x faster searches on average
|
||||
@@ -22,17 +24,189 @@ If you have issues with NEI outside of the GTNH modpack you may report them in t
|
||||
* Cycle between Recipe, Utility, and Cheat mode by ctrl clicking on the Wrench Icon
|
||||
* GT5u Tools/Items and GT6 tools should now properly work with the Overlay Recipe Transfer
|
||||
|
||||
## Other items of note:
|
||||
### Other items of note:
|
||||
|
||||
* Remove TMI style
|
||||
* Removed inventory Load/Save state
|
||||
|
||||
## Adding support for GTNH NEI features to your mod
|
||||
|
||||
### Help! My mod is broken in your version of NEI! How can I fix it?
|
||||
|
||||
Our version of NEI changes the recipe UI to be a bit more similar to [JEI][JEI]. As such, some legacy recipe handlers that assume the specific UI layout of old NEI might break even after providing additional metadata. The UI changes include following: the recipe screen is no longer has a fixed height, but can stretch across the screen to show more recipes at once. Additionally, the screen is no longer vertically centered, but at a fixed offset from the top of the MC window. Furthermore, the recipe paging widget has been moved from the bottom to the top of the recipe screen.
|
||||
|
||||
The following sections list strategies for fixing broken handlers. Remember, you are always welcome to an issue in our repository if you are stuck with a broken recipe handler.
|
||||
|
||||
#### I cannot update my mod, because it is no longer maintained, and I'm not a developer
|
||||
|
||||
Some mods are no longer maintained and cannot be updated due to licensing. For those we provide a last-ditch effort called the "height hack". This tries to emulate the old NEI recipe layout, specifically on the vertical axis where our version of NEI had the most significant changes. This should help with misaligned tooltips and click zones especially.
|
||||
|
||||
The height hack can be enabled by adding the fully-qualified class name of the recipe handler to the `heighthackhandlers.cfg` config file. If you encounter a recipe handler that requires this measure please open an issue and let us know.
|
||||
|
||||
#### I'm a developer working on my own mod or maintaining a forked mod
|
||||
|
||||
Please consider adding support for our IMC messages or events to automatically register handler metadata for your mod. Alternatively, we can provide default metadata for your recipe handlers in `assets/nei/csv/handlers.csv`, let us know the parameters, or even better, open a pull request.
|
||||
|
||||
Even after providing handler metadata, there may still be broken elements in your handler. In our experience this most often pertains to tooltips and custom click zones. **Please make sure to not rely on a fixed screen layout!** In particular, do not use `height` to calculate the top edge of the recipe UI, instead use `guiTop`. Also, do not assume a fixed offset from the top edge of the recipe screen (the offset is different in legacy NEI compared to our version), instead use `GuiRecipe.getRecipePosition()`. `GuiRecipe` may already be passed to certain handler methods if you're overriding `TemplateRecipeHandler`, alternatively, you can obtain a reference to it via:
|
||||
```java
|
||||
GuiRecipe gui = (GuiRecipe) Minecraft.getMinecraft().currentScreen;
|
||||
```
|
||||
|
||||
Here is an example of a poorly implemented recipe handler:
|
||||
```java
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiRecipe gui, List<String> list, int recipeIdx) {
|
||||
CachedMachineRecipe r = (CachedMachineRecipe) this.arecipes.get(recipeIdx % this.arecipes.size());
|
||||
if (r != null) {
|
||||
Point mousePosition = GuiDraw.getMousePosition();
|
||||
int gleft = (gui.width - 176) / 2;
|
||||
int gtop = (gui.height - 134) / 2; // BAD: uses gui.height instead of gui.guiTop
|
||||
if (r.fluid != null) {
|
||||
if (mousePosition.x > gleft + 110
|
||||
&& mousePosition.x <= gleft + 110 + 16
|
||||
&& mousePosition.y > gtop + 13 // BAD: assumes a fixed offset from gtop/guiTop
|
||||
&& mousePosition.y <= gtop + 13 + 47) {
|
||||
list.add(r.fluid.getLocalizedName());
|
||||
list.add(r.fluid.amount + " mB");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.handleTooltip(gui, list, recipeIdx);
|
||||
}
|
||||
```
|
||||
Here is an improved version that should work both in our NEI and in legacy NEI:
|
||||
```java
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiRecipe gui, List<String> list, int recipeIdx) {
|
||||
CachedMachineRecipe r = (CachedMachineRecipe) this.arecipes.get(recipeIdx % this.arecipes.size());
|
||||
if (r != null) {
|
||||
Point mousePosition = GuiDraw.getMousePosition();
|
||||
Point recipePosition = gui.getRecipePosition(recipeIdx);
|
||||
if (r.fluid != null) {
|
||||
if (mousePosition.x > (gui.guiLeft + recipePosition.x + 110)
|
||||
&& mousePosition.x <= (gui.guiLeft + recipePosition.x + 110 + 16)
|
||||
&& mousePosition.y > (gui.guiTop + recipePosition.y + 13)
|
||||
&& mousePosition.y <= (gui.guiTop + recipePosition.y + 13 + 47) {
|
||||
list.add(r.fluid.getLocalizedName());
|
||||
list.add(r.fluid.amount + " mB");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.handleTooltip(gui, list, recipeIdx);
|
||||
}
|
||||
```
|
||||
|
||||
### Metadata
|
||||
|
||||
Legacy versions of NEI only had a relatively small, fixed size recipe screen, only showing one or two recipes at a time. Our version, borrowing from JEI, improves this by switching to a flexible screen height that allows showing up to 5 recipes at a time in many cases. In addition, the new JEI-style tab bar improves navigation by shows an icon for each recipe handler.
|
||||
|
||||
To enable these new capabilities, NEI has to be given additional metadata to make it work. This version of NEI includes new native APIs and additionally ships with two files `assets/nei/csv/handlers.csv`, and `assets/nei/csv/catalysts.csv` to include the necessary information for mods that are no longer updated and do not take advantage of the APIs. If you are working on a mod of your own that includes NEI integration, we encourage you to add IMC or event support as described below.
|
||||
|
||||
#### Recipe handler metadata
|
||||
|
||||
(values are strings if not specified otherwise)
|
||||
|
||||
- **handler:** handler ID, usually the fully-qualified class name of the recipe handler (including package name); can differ to provide multiple handlers from a single class; *required*
|
||||
- **modName:** display name of the mod to which the recipe handler belongs to, i.e. "Applied Energistics 2"; *required*
|
||||
- **itemName**, and **nbtInfo:** item used as an icon to represent the recipe handler in the tab bar
|
||||
- **modId:** modid of the mod for which the recipe handler is responsible; *required*
|
||||
- **modRequired:** whether the mod specified in `modId` needs to be present in order for NEI to load the recipe handler (boolean value; `TRUE`/`FALSE` in CSV)
|
||||
- **excludedModId:** prevent the recipe handler from being loaded if the specified mod is present
|
||||
- **yShift:** allows fine control over vertical alignment of the recipes from top of the recipe screen; value is in pixels (integer value)
|
||||
- **handlerHeight:** height of a single recipe in pixels, used for tiling multiple recipes vertically according to `maxRecipesPerPage` (integer value)
|
||||
- **handlerWidth:** width of a single recipe in pixels (integer value)
|
||||
- **maxRecipesPerPage:** maximum number of recipes to show per page; less recipes will be shown if they do not fit on the screen (integer value)
|
||||
- **imageResource**, **imageX**, **imageY**, **imageWidth**, and **imageHeight:** allow specifying an arbitrary texture as icon for this recipe handler instead of an item; `imageX`, `imageY`, `imageWidth`, and `imageHeight` allow indexing into a sprite sheet (integer values except for `imageResource`)
|
||||
- **itemNotes:** ignored by NEI; this field is purely informational for development; not available via IMC/event
|
||||
|
||||
#### Catalyst metadata
|
||||
|
||||
The catalyst concept has been borrowed from JEI. The idea behind it is, that in addition to the recipe inputs and outputs, a recipe is also associated with the "machine" that processes it (also called a 'catalyst'). That way, if you look up a recipe you can also see which "machines" enable it. For example regular crafting recipes can be processed in a Crafting Table, however there may be many more blocks that provide the same functionality and NEI now lists them alongside the recipe. Similarly, if you look up uses for a "machine" or catalyst, it will automatically show all recipes that can be processed with it.
|
||||
|
||||
Again, this needs additional metadata work, either provided by mods themselves, or through default configuration in `assets/nei/csv/catalysts.csv`.
|
||||
|
||||
(values are strings if not specified otherwise)
|
||||
|
||||
- **handlerID:** id of the recipe handler for which this catalyst can be used; it's the fully-qualified handler class name in most cases; *required*
|
||||
- **itemName:**, and **nbtInfo:** actual catalyst item; *required*
|
||||
- **modId:** modid of the mod which includes the catalyst
|
||||
- **modRequired:** whether the mod specified in `modId` needs to be present in order for NEI to load the catalyst (boolean value; `TRUE`/`FALSE` in CSV)
|
||||
- **excludedModId:** prevent the catalyst from being loaded if the specified mod is present
|
||||
- **priority:** position of the catalyst within the list of all possible catalysts for a given recipe handler; default priority is 0; higher priority takes precedence (integer value)
|
||||
- **minVersion:**, and **maxVersion:** only present in `catalysts.csv`, currently unused
|
||||
- **forceClassName:** traditionally, NEI used the fully-qualified handler class name, this restriction is lifted in this version of NEI, allowing handlers to specify their own ID and letting a single handler class act as multiple different handlers; this forces the catalyst to match on the handler class name; only needs to be used in rare cases; only present in `catalysts.csv` (boolean value)
|
||||
- **itemNotes:** ignored by NEI; this field is purely informational for development; not available via IMC
|
||||
|
||||
#### IMC
|
||||
|
||||
Our version of NEI adds a range of IMC messages for registering handler metadata. This is the preferred way of specifying handler metadata. Please consider adding support for this in your own mod.
|
||||
|
||||
The following messages are available:
|
||||
- **registerHandlerInfo:** NBT IMC message; allowed keys are specified in the handler metadata section
|
||||
- **removeHandlerInfo:** NBT IMC message; required key: `handler`, ID string of the handler to be removed (usually the fully-qualified name of the handler class)
|
||||
- **registerCatalystInfo:** NBT IMC message; allowed keys are specified in the catalyst metadata section
|
||||
- **removeCatalystInfo:** NBT IMC message; required keys: `handlerID` (usually the fully-qualified name of the handler class), `itemName` (optionally specify `nbtInfo` if necessary)
|
||||
|
||||
Here is an example of how to send the handler and catalyst metadata via IMC:
|
||||
```java
|
||||
NBTTagCompound handlerMetadata = new NBTTagCompound();
|
||||
handlerMetadata.setString("handler", NEIInscriberRecipeHandler.class.getName());
|
||||
handlerMetadata.setString("modName", MOD_NAME);
|
||||
handlerMetadata.setString("modId", MOD_ID);
|
||||
handlerMetadata.setBoolean("modRequired", true);
|
||||
handlerMetadata.setString("itemName", GameRegistry.findUniqueIdentifierFor(block));
|
||||
handlerMetadata.setInteger("handlerHeight", 70);
|
||||
handlerMetadata.setInteger("maxRecipesPerPage", 5);
|
||||
handlerMetadata.setInteger("yShift", 0);
|
||||
FMLInterModComms.sendMessage("NotEnoughItems", "registerHandlerInfo", handlerMetadata);
|
||||
|
||||
NBTTagCompound catalystMetadata = new NBTTagCompound();
|
||||
catalystMetadata.setString("handlerID", NEIInscriberRecipeHandler.class.getName());
|
||||
catalystMetadata.setString("itemName", GameRegistry.findUniqueIdentifierFor(block));
|
||||
catalystMetadata.setInteger("priority", 0);
|
||||
FMLInterModComms.sendMessage("NotEnoughItems", "registerCatalystInfo", catalystMetadata);
|
||||
```
|
||||
|
||||
#### Event
|
||||
|
||||
Besides IMC, there exists another native path for adding metadata to recipe handlers: subscribing to `NEIRegisterHandlerInfosEvent`. This requires adding NEI as a dependency to your project.
|
||||
|
||||
This event provides the `registerHandlerInfo()` method for adding metadata to your handlers. It takes a `Consumer` function which receives a `HandlerInfo` builder (`HandlerInfo` is the NEI class representing handler metadata).
|
||||
|
||||
Here is an example for handling such an event:
|
||||
```java
|
||||
@SubscribeEvent
|
||||
public void registerHandlers(NEIRegisterHandlerInfosEvent event) {
|
||||
event.registerHandlerInfo(
|
||||
handlerID,
|
||||
modName,
|
||||
modId,
|
||||
(builder) -> {
|
||||
return builder.setHeight(30).setMaxRecipesPerPage(5);
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Developing NEI
|
||||
|
||||
Before launching, you need to add
|
||||
```
|
||||
-Dfml.coreMods.load=codechicken.nei.asm.NEICorePlugin
|
||||
```
|
||||
as a command line argument to the VM.
|
||||
|
||||
## License
|
||||
|
||||
GTNH Modifications Copyright (c) 2019-2022 mitchej123 and the GTNH Team
|
||||
|
||||
Licensed under LGPL-3.0 or later - use this however you want, but please give back any modifications
|
||||
|
||||
Parts inspired/borrowed/backported from [JEI](https://github.com/mezz/JustEnoughItems/tree/1.12) under the MIT License.
|
||||
Parts inspired/borrowed/backported from [JEI][JEI112Tree] under the MIT License.
|
||||
|
||||
Originial code Copyright (c) 2014-2015 mezz and was licensed under the MIT License.
|
||||
Original code Copyright (c) 2014-2015 mezz and was licensed under the MIT License.
|
||||
|
||||
[JEI]: https://github.com/mezz/JustEnoughItems
|
||||
[JEI112Tree]: https://github.com/mezz/JustEnoughItems/tree/1.12
|
||||
+62
-141
@@ -1,4 +1,4 @@
|
||||
//version: 1692122114
|
||||
//version: 1685785062
|
||||
/*
|
||||
DO NOT CHANGE THIS FILE!
|
||||
Also, you may replace this file at any time if there is an update available.
|
||||
@@ -69,7 +69,7 @@ plugins {
|
||||
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
|
||||
id 'com.modrinth.minotaur' version '2.+' apply false
|
||||
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
|
||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24'
|
||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14'
|
||||
}
|
||||
|
||||
print("You might want to check out './gradlew :faq' if your build fails.\n")
|
||||
@@ -115,8 +115,6 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
|
||||
propertyDefaultIfUnset("forceEnableMixins", false)
|
||||
propertyDefaultIfUnset("channel", "stable")
|
||||
propertyDefaultIfUnset("mappingsVersion", "12")
|
||||
propertyDefaultIfUnset("usesMavenPublishing", true)
|
||||
propertyDefaultIfUnset("mavenPublishUrl", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases")
|
||||
propertyDefaultIfUnset("modrinthProjectId", "")
|
||||
propertyDefaultIfUnset("modrinthRelations", "")
|
||||
propertyDefaultIfUnset("curseForgeProjectId", "")
|
||||
@@ -359,27 +357,7 @@ catch (Exception ignored) {
|
||||
String identifiedVersion
|
||||
String versionOverride = System.getenv("VERSION") ?: null
|
||||
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) {
|
||||
def gitDetails = versionDetails()
|
||||
def isDirty = gitVersion().endsWith(".dirty") // No public API for this, isCleanTag has a different meaning
|
||||
String branchName = gitDetails.branchName ?: (System.getenv('GIT_BRANCH') ?: 'git')
|
||||
if (branchName.startsWith('origin/')) {
|
||||
branchName = branchName.minus('origin/')
|
||||
}
|
||||
branchName = branchName.replaceAll("[^a-zA-Z0-9-]+", "-") // sanitize branch names for semver
|
||||
identifiedVersion = gitDetails.lastTag ?: '${gitDetails.gitHash}'
|
||||
if (gitDetails.commitDistance > 0) {
|
||||
identifiedVersion += "-${branchName}.${gitDetails.commitDistance}+${gitDetails.gitHash}"
|
||||
if (isDirty) {
|
||||
identifiedVersion += "-dirty"
|
||||
}
|
||||
} else if (isDirty) {
|
||||
identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty"
|
||||
}
|
||||
} else {
|
||||
identifiedVersion = versionOverride
|
||||
}
|
||||
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
out.style(Style.Failure).text(
|
||||
@@ -401,13 +379,9 @@ if (identifiedVersion == versionOverride) {
|
||||
|
||||
group = "com.github.GTNewHorizons"
|
||||
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
||||
base {
|
||||
archivesName = customArchiveBaseName
|
||||
}
|
||||
archivesBaseName = customArchiveBaseName
|
||||
} else {
|
||||
base {
|
||||
archivesName = modId
|
||||
}
|
||||
archivesBaseName = modId
|
||||
}
|
||||
|
||||
|
||||
@@ -491,19 +465,10 @@ sourceSets {
|
||||
}
|
||||
}
|
||||
|
||||
if (file('addon.gradle.kts').exists()) {
|
||||
apply from: 'addon.gradle.kts'
|
||||
} else if (file('addon.gradle').exists()) {
|
||||
if (file('addon.gradle').exists()) {
|
||||
apply from: 'addon.gradle'
|
||||
}
|
||||
|
||||
// File for local tweaks not commited to Git
|
||||
if (file('addon.local.gradle.kts').exists()) {
|
||||
apply from: 'addon.local.gradle.kts'
|
||||
} else if (file('addon.local.gradle').exists()) {
|
||||
apply from: 'addon.local.gradle'
|
||||
}
|
||||
|
||||
// Allow unsafe repos but warn
|
||||
repositories.configureEach { repo ->
|
||||
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
|
||||
@@ -514,14 +479,7 @@ repositories.configureEach { repo ->
|
||||
}
|
||||
}
|
||||
|
||||
if (file('repositories.gradle.kts').exists()) {
|
||||
apply from: 'repositories.gradle.kts'
|
||||
} else if (file('repositories.gradle').exists()) {
|
||||
apply from: 'repositories.gradle'
|
||||
} else {
|
||||
logger.error("Neither repositories.gradle.kts nor repositories.gradle was found, make sure you extracted the full ExampleMod template.")
|
||||
throw new RuntimeException("Missing repositories.gradle[.kts]")
|
||||
}
|
||||
apply from: 'repositories.gradle'
|
||||
|
||||
configurations {
|
||||
runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
|
||||
@@ -562,6 +520,9 @@ repositories {
|
||||
maven {
|
||||
name 'Overmind forge repo mirror'
|
||||
url 'https://gregtech.overminddl1.com/'
|
||||
mavenContent {
|
||||
excludeGroup("net.minecraftforge") // missing the `universal` artefact
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "GTNH Maven"
|
||||
@@ -576,28 +537,13 @@ repositories {
|
||||
}
|
||||
}
|
||||
if (includeWellKnownRepositories.toBoolean()) {
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven {
|
||||
name "CurseMaven"
|
||||
url "https://cursemaven.com"
|
||||
}
|
||||
}
|
||||
filter {
|
||||
maven {
|
||||
name "CurseMaven"
|
||||
url "https://cursemaven.com"
|
||||
content {
|
||||
includeGroup "curse.maven"
|
||||
}
|
||||
}
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven {
|
||||
name = "Modrinth"
|
||||
url = "https://api.modrinth.com/maven"
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroup "maven.modrinth"
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "ic2"
|
||||
url = "https://maven.ic2.player.to/"
|
||||
@@ -628,8 +574,6 @@ def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}
|
||||
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
|
||||
ext.mixinProviderSpec = mixinProviderSpec
|
||||
|
||||
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
|
||||
|
||||
dependencies {
|
||||
if (usesMixins.toBoolean()) {
|
||||
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
|
||||
@@ -641,7 +585,7 @@ dependencies {
|
||||
}
|
||||
}
|
||||
if (usesMixins.toBoolean()) {
|
||||
implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap))
|
||||
implementation(mixinProviderSpec)
|
||||
} else if (forceEnableMixins.toBoolean()) {
|
||||
runtimeOnlyNonPublishable(mixinProviderSpec)
|
||||
}
|
||||
@@ -667,32 +611,12 @@ configurations.all {
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
constraints {
|
||||
def minGtnhLibVersion = "0.0.13"
|
||||
implementation("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
|
||||
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
|
||||
}
|
||||
runtimeOnly("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
|
||||
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
|
||||
}
|
||||
devOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
|
||||
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
|
||||
}
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
|
||||
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
|
||||
}
|
||||
}
|
||||
}
|
||||
apply from: 'dependencies.gradle'
|
||||
|
||||
if (file('dependencies.gradle.kts').exists()) {
|
||||
apply from: 'dependencies.gradle.kts'
|
||||
} else if (file('dependencies.gradle').exists()) {
|
||||
apply from: 'dependencies.gradle'
|
||||
} else {
|
||||
logger.error("Neither dependencies.gradle.kts nor dependencies.gradle was found, make sure you extracted the full ExampleMod template.")
|
||||
throw new RuntimeException("Missing dependencies.gradle[.kts]")
|
||||
}
|
||||
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
|
||||
def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins'
|
||||
def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap
|
||||
def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg"
|
||||
|
||||
tasks.register('generateAssets') {
|
||||
group = "GTNH Buildscript"
|
||||
@@ -724,17 +648,46 @@ tasks.register('generateAssets') {
|
||||
}
|
||||
|
||||
if (usesMixins.toBoolean()) {
|
||||
tasks.named("reobfJar", ReobfuscatedJar).configure {
|
||||
extraSrgFiles.from(mixinSrg)
|
||||
}
|
||||
|
||||
tasks.named("processResources").configure {
|
||||
dependsOn("generateAssets")
|
||||
}
|
||||
|
||||
tasks.named("compileJava", JavaCompile).configure {
|
||||
doFirst {
|
||||
new File(mixinTmpDir).mkdirs()
|
||||
}
|
||||
options.compilerArgs += [
|
||||
"-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}",
|
||||
"-AoutSrgFile=${mixinSrg}",
|
||||
"-AoutRefMapFile=${refMap}",
|
||||
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
|
||||
"-XDenableSunApiLintControl",
|
||||
"-XDignore.symbol.file"
|
||||
]
|
||||
}
|
||||
|
||||
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
|
||||
kapt {
|
||||
correctErrorTypes = true
|
||||
javacOptions {
|
||||
option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}")
|
||||
option("-AoutSrgFile=$mixinSrg")
|
||||
option("-AoutRefMapFile=$refMap")
|
||||
}
|
||||
}
|
||||
tasks.configureEach { task ->
|
||||
if (task.name == "kaptKotlin") {
|
||||
task.doFirst {
|
||||
new File(mixinTmpDir).mkdirs()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tasks.named("processResources", ProcessResources).configure {
|
||||
@@ -752,6 +705,7 @@ tasks.named("processResources", ProcessResources).configure {
|
||||
}
|
||||
|
||||
if (usesMixins.toBoolean()) {
|
||||
from refMap
|
||||
dependsOn("compileJava", "compileScala")
|
||||
}
|
||||
}
|
||||
@@ -770,16 +724,16 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def lwjgl3ifyVersion = '1.4.0'
|
||||
def lwjgl3ifyVersion = '1.3.5'
|
||||
def asmVersion = '9.4'
|
||||
if (modId != 'lwjgl3ify') {
|
||||
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
|
||||
}
|
||||
if (modId != 'hodgepodge') {
|
||||
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.26')
|
||||
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13')
|
||||
}
|
||||
|
||||
java17PatchDependencies('net.minecraft:launchwrapper:1.17.2') {transitive = false}
|
||||
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
|
||||
java17PatchDependencies("org.ow2.asm:asm:${asmVersion}")
|
||||
java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}")
|
||||
java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}")
|
||||
@@ -1025,9 +979,6 @@ idea {
|
||||
}
|
||||
}
|
||||
runConfigurations {
|
||||
"0. Build and Test"(Gradle) {
|
||||
taskNames = ["build"]
|
||||
}
|
||||
"1. Run Client"(Gradle) {
|
||||
taskNames = ["runClient"]
|
||||
}
|
||||
@@ -1147,14 +1098,6 @@ tasks.named("processIdeaSettings").configure {
|
||||
dependsOn("injectTags")
|
||||
}
|
||||
|
||||
tasks.named("ideVirtualMainClasses").configure {
|
||||
// Make IntelliJ "Build project" build the mod jars
|
||||
dependsOn("jar", "reobfJar")
|
||||
if (!disableSpotless) {
|
||||
dependsOn("spotlessCheck")
|
||||
}
|
||||
}
|
||||
|
||||
// workaround variable hiding in pom processing
|
||||
def projectConfigs = project.configurations
|
||||
|
||||
@@ -1175,14 +1118,12 @@ publishing {
|
||||
}
|
||||
|
||||
repositories {
|
||||
if (usesMavenPublishing.toBoolean()) {
|
||||
maven {
|
||||
url = mavenPublishUrl
|
||||
allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven
|
||||
credentials {
|
||||
username = System.getenv("MAVEN_USER") ?: "NONE"
|
||||
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
|
||||
}
|
||||
maven {
|
||||
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
|
||||
allowInsecureProtocol = true
|
||||
credentials {
|
||||
username = System.getenv("MAVEN_USER") ?: "NONE"
|
||||
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1297,7 +1238,7 @@ def addCurseForgeRelation(String type, String name) {
|
||||
|
||||
// Updating
|
||||
|
||||
def buildscriptGradleVersion = "8.2.1"
|
||||
def buildscriptGradleVersion = "8.1.1"
|
||||
|
||||
tasks.named('wrapper', Wrapper).configure {
|
||||
gradleVersion = buildscriptGradleVersion
|
||||
@@ -1403,14 +1344,8 @@ boolean isNewBuildScriptVersionAvailable() {
|
||||
|
||||
String currentBuildScript = getFile("build.gradle").getText()
|
||||
String currentBuildScriptHash = getVersionHash(currentBuildScript)
|
||||
String availableBuildScriptHash
|
||||
try {
|
||||
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
|
||||
availableBuildScriptHash = getVersionHash(availableBuildScript)
|
||||
} catch (IOException e) {
|
||||
logger.warn("Could not check for buildscript update availability: {}", e.message)
|
||||
return false
|
||||
}
|
||||
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
|
||||
String availableBuildScriptHash = getVersionHash(availableBuildScript)
|
||||
|
||||
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
|
||||
return !isUpToDate
|
||||
@@ -1575,17 +1510,3 @@ def getSecondaryArtifacts() {
|
||||
if (apiPackage) secondaryArtifacts += [apiJar]
|
||||
return secondaryArtifacts
|
||||
}
|
||||
|
||||
// For easier scripting of things that require variables defined earlier in the buildscript
|
||||
if (file('addon.late.gradle.kts').exists()) {
|
||||
apply from: 'addon.late.gradle.kts'
|
||||
} else if (file('addon.late.gradle').exists()) {
|
||||
apply from: 'addon.late.gradle'
|
||||
}
|
||||
|
||||
// File for local tweaks not commited to Git
|
||||
if (file('addon.late.local.gradle.kts').exists()) {
|
||||
apply from: 'addon.late.local.gradle.kts'
|
||||
} else if (file('addon.late.local.gradle').exists()) {
|
||||
apply from: 'addon.late.local.gradle'
|
||||
}
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
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.1.1-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -85,6 +85,9 @@ done
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
@@ -194,10 +197,6 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
|
||||
@@ -26,6 +26,3 @@ blowdryerSetup {
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
|
||||
rootProject.name = "NotEnoughItems"
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiChest;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IBookmarkContainerHandler;
|
||||
|
||||
public class BookmarkContainerInfo {
|
||||
|
||||
private static final HashMap<Class<? extends GuiContainer>, IBookmarkContainerHandler> handlerMap = new HashMap<>();
|
||||
|
||||
public static void registerBookmarkContainerHandler(Class<? extends GuiContainer> classz,
|
||||
IBookmarkContainerHandler handler) {
|
||||
handlerMap.put(classz, handler);
|
||||
}
|
||||
|
||||
public static boolean hasBookmarkContainerHandler(Class<? extends GuiContainer> classz) {
|
||||
return handlerMap.containsKey(classz);
|
||||
}
|
||||
|
||||
public static IBookmarkContainerHandler getBookmarkContainerHandler(GuiContainer gui) {
|
||||
return handlerMap.get(gui.getClass());
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
API.registerBookmarkContainerHandler(GuiChest.class, new DefaultBookmarkContainerHandler());
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package codechicken.nei;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawRect;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
import static codechicken.nei.NEIClientUtils.getGuiContainer;
|
||||
import static codechicken.nei.NEIClientUtils.translate;
|
||||
|
||||
import java.awt.Point;
|
||||
@@ -33,7 +32,6 @@ import com.google.gson.JsonSyntaxException;
|
||||
import codechicken.core.CommonUtils;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemPanel.ItemPanelSlot;
|
||||
import codechicken.nei.api.IBookmarkContainerHandler;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.BookmarkRecipeId;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
@@ -49,7 +47,6 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|
||||
public Button namespacePrev;
|
||||
public Button namespaceNext;
|
||||
public Button pullBookmarkedItems;
|
||||
public Label namespaceLabel;
|
||||
|
||||
protected List<BookmarkGrid> namespaces = new ArrayList<>();
|
||||
@@ -87,10 +84,6 @@ public class BookmarkPanel extends PanelWidget {
|
||||
protected boolean[] todoSpaces;
|
||||
protected int todoItemsCount = 0;
|
||||
|
||||
public BookmarkGrid() {
|
||||
this.setShowRecipeTooltips(true);
|
||||
}
|
||||
|
||||
public void setViewMode(BookmarkViewMode mode) {
|
||||
if (viewMode == mode) {
|
||||
return;
|
||||
@@ -420,21 +413,6 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
};
|
||||
|
||||
pullBookmarkedItems = new Button("Pull") {
|
||||
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
if (rightclick) {
|
||||
return false;
|
||||
}
|
||||
return pullBookmarkItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRenderLabel() {
|
||||
return "P";
|
||||
}
|
||||
};
|
||||
|
||||
namespaces.add(new BookmarkGrid());
|
||||
grid = namespaces.get(activeNamespaceIndex);
|
||||
}
|
||||
@@ -486,7 +464,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
final ItemStack normalizedA = StackInfo.loadFromNBT(nbTagA);
|
||||
BookmarkRecipeId recipeId = null;
|
||||
|
||||
if (handlerName != "" && ingredients != null) {
|
||||
if (handlerName != "" && ingredients != null && !ingredients.isEmpty()) {
|
||||
recipeId = new BookmarkRecipeId(handlerName, ingredients);
|
||||
}
|
||||
|
||||
@@ -496,7 +474,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
BGrid.removeRecipe(idx, saveIngredients);
|
||||
} else {
|
||||
|
||||
if (saveIngredients && handlerName != "" && ingredients != null) {
|
||||
if (saveIngredients && handlerName != "" && ingredients != null && !ingredients.isEmpty()) {
|
||||
final Map<NBTTagCompound, Integer> unique = new HashMap<>();
|
||||
final ArrayList<NBTTagCompound> sorted = new ArrayList<>();
|
||||
|
||||
@@ -838,9 +816,9 @@ public class BookmarkPanel extends PanelWidget {
|
||||
final int center = leftBorder + Math.max(0, (rightBorder - leftBorder) / 2);
|
||||
int labelWidth = 2;
|
||||
|
||||
namespacePrev.h = namespaceNext.h = pullBookmarkedItems.h = BUTTON_SIZE;
|
||||
namespacePrev.w = namespaceNext.w = pullBookmarkedItems.w = BUTTON_SIZE;
|
||||
namespacePrev.y = namespaceNext.y = pullBookmarkedItems.y = y + h - BUTTON_SIZE;
|
||||
namespacePrev.h = namespaceNext.h = BUTTON_SIZE;
|
||||
namespacePrev.w = namespaceNext.w = BUTTON_SIZE;
|
||||
namespacePrev.y = namespaceNext.y = y + h - BUTTON_SIZE;
|
||||
|
||||
if (rightBorder - leftBorder >= 70) {
|
||||
labelWidth = 36;
|
||||
@@ -855,7 +833,6 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|
||||
namespacePrev.x = center - labelWidth / 2 - 2 - namespacePrev.w;
|
||||
namespaceNext.x = center + labelWidth / 2 + 2;
|
||||
pullBookmarkedItems.x = center + 2 * labelWidth / 2 + 2;
|
||||
|
||||
return BUTTON_SIZE + 2;
|
||||
}
|
||||
@@ -868,9 +845,6 @@ public class BookmarkPanel extends PanelWidget {
|
||||
LayoutManager.addWidget(namespacePrev);
|
||||
LayoutManager.addWidget(namespaceNext);
|
||||
LayoutManager.addWidget(namespaceLabel);
|
||||
if (BookmarkContainerInfo.getBookmarkContainerHandler(getGuiContainer()) != null) {
|
||||
LayoutManager.addWidget(pullBookmarkedItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1057,10 +1031,6 @@ public class BookmarkPanel extends PanelWidget {
|
||||
.contains(mx, my)) {
|
||||
tooltip.add(translate("bookmark.viewmode.toggle.tip"));
|
||||
}
|
||||
if (new Rectangle4i(pullBookmarkedItems.x, pullBookmarkedItems.y, pullBookmarkedItems.w, pullBookmarkedItems.h)
|
||||
.contains(mx, my) && BookmarkContainerInfo.getBookmarkContainerHandler(getGuiContainer()) != null) {
|
||||
tooltip.add(translate("bookmark.pullBookmarkedItems.tip"));
|
||||
}
|
||||
|
||||
return super.handleTooltip(mx, my, tooltip);
|
||||
}
|
||||
@@ -1110,10 +1080,6 @@ public class BookmarkPanel extends PanelWidget {
|
||||
final BookmarkRecipeId recipeId = BGrid.getRecipeId(slot.slotIndex);
|
||||
final boolean addFullRecipe = NEIClientUtils.shiftKey();
|
||||
|
||||
if (NEIClientUtils.altKey()) {
|
||||
shift *= slot.item.getMaxStackSize();
|
||||
}
|
||||
|
||||
if (addFullRecipe) {
|
||||
BookmarkStackMeta iMeta;
|
||||
|
||||
@@ -1152,14 +1118,4 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean pullBookmarkItems() {
|
||||
IBookmarkContainerHandler containerHandler = BookmarkContainerInfo
|
||||
.getBookmarkContainerHandler(getGuiContainer());
|
||||
if (containerHandler == null) {
|
||||
return false;
|
||||
}
|
||||
containerHandler.pullBookmarkItemsFromContainer(getGuiContainer(), ((BookmarkGrid) grid).realItems);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.nei.api.IBookmarkContainerHandler;
|
||||
|
||||
public class DefaultBookmarkContainerHandler implements IBookmarkContainerHandler {
|
||||
|
||||
@Override
|
||||
public void pullBookmarkItemsFromContainer(GuiContainer guiContainer, ArrayList<ItemStack> bookmarkItems) {
|
||||
FastTransferManager manager = new FastTransferManager();
|
||||
LinkedList<ItemStack> containerStacks = manager.saveContainer(guiContainer.inventorySlots);
|
||||
|
||||
for (ItemStack bookmarkItem : bookmarkItems) {
|
||||
|
||||
int bookmarkSizeBackup = bookmarkItem.stackSize;
|
||||
|
||||
for (int i = 0; i < containerStacks.size() - 4 * 9; i++) { // Last 36 slots are player inventory
|
||||
ItemStack containerItem = containerStacks.get(i);
|
||||
|
||||
if (containerItem == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bookmarkItem.isItemEqual(containerItem)) {
|
||||
if (bookmarkItem.stackSize <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
int transferAmount = Math.min(bookmarkItem.stackSize, containerItem.stackSize);
|
||||
|
||||
manager.transferItems(guiContainer, i, transferAmount);
|
||||
bookmarkItem.stackSize -= transferAmount;
|
||||
|
||||
if (bookmarkItem.stackSize == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
bookmarkItem.stackSize = bookmarkSizeBackup;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,12 +184,6 @@ public class FastTransferManager {
|
||||
moveOutputSet(window, fromSlot, toSlot);
|
||||
}
|
||||
|
||||
public void transferItems(GuiContainer window, int fromSlot, int itemCount) {
|
||||
for (int i = 0; i < itemCount; i++) {
|
||||
transferItem(window, fromSlot);
|
||||
}
|
||||
}
|
||||
|
||||
public void moveOutputSet(GuiContainer window, int fromSlot, int toSlot) {
|
||||
if (NEIClientUtils.getHeldItem() != null) return;
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
public class ItemMobSpawner extends ItemBlock {
|
||||
|
||||
private static final Map<Integer, EntityLiving> entityHashMap = new HashMap<>();
|
||||
private static final Map<Integer, String> IDtoNameMap = new HashMap<>();
|
||||
private static Map<Integer, EntityLiving> entityHashMap;
|
||||
private static Map<Integer, String> IDtoNameMap;
|
||||
public static int idPig;
|
||||
private static boolean loaded;
|
||||
|
||||
@@ -32,6 +32,9 @@ public class ItemMobSpawner extends ItemBlock {
|
||||
|
||||
hasSubtypes = true;
|
||||
MinecraftForgeClient.registerItemRenderer(this, new SpawnerRenderer());
|
||||
|
||||
entityHashMap = new HashMap<>();
|
||||
IDtoNameMap = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,37 +1,27 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawRect;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.shader.Framebuffer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemPanel.ItemPanelSlot;
|
||||
import codechicken.nei.api.GuiInfo;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.BookmarkRecipeId;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
|
||||
public class ItemsGrid {
|
||||
@@ -53,7 +43,6 @@ public class ItemsGrid {
|
||||
|
||||
protected int rows;
|
||||
protected int columns;
|
||||
protected boolean showRecipeTooltips = false;
|
||||
|
||||
protected boolean[] invalidSlotMap;
|
||||
|
||||
@@ -161,10 +150,6 @@ public class ItemsGrid {
|
||||
refreshBuffer = true;
|
||||
}
|
||||
|
||||
public void setShowRecipeTooltips(boolean show) {
|
||||
this.showRecipeTooltips = show;
|
||||
}
|
||||
|
||||
public void refresh(GuiContainer gui) {
|
||||
updateGuiOverlapSlots(gui);
|
||||
shiftPage(0);
|
||||
@@ -259,127 +244,6 @@ public class ItemsGrid {
|
||||
}
|
||||
}
|
||||
|
||||
private int recipeTooltipSlotIdx = -1;
|
||||
private int recipeTooltipLines = 2;
|
||||
private Runnable recipeTooltipUpdater = null;
|
||||
private GuiRecipe<?> recipeTooltipGui = null;
|
||||
|
||||
public void update() {
|
||||
if (recipeTooltipUpdater != null) {
|
||||
recipeTooltipUpdater.run();
|
||||
recipeTooltipUpdater = null;
|
||||
}
|
||||
if (recipeTooltipGui != null) {
|
||||
recipeTooltipGui.updateAsTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> List<T> listOrEmptyList(final List<T> listOrNull) {
|
||||
return listOrNull == null ? Collections.emptyList() : listOrNull;
|
||||
}
|
||||
|
||||
private void drawRecipeTooltip(int mousex, int mousey, List<String> itemTooltip) {
|
||||
if (!NEIClientConfig.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
ItemPanelSlot focused = getSlotMouseOver(mousex, mousey);
|
||||
if (focused == null) {
|
||||
recipeTooltipSlotIdx = -1;
|
||||
recipeTooltipGui = null;
|
||||
return;
|
||||
}
|
||||
final List<Integer> mask = getMask();
|
||||
|
||||
int slotIdx = -1;
|
||||
for (int i = 0; i < mask.size(); i++) {
|
||||
if (mask.get(i) == null) {
|
||||
continue;
|
||||
}
|
||||
if (focused.slotIndex != mask.get(i)) {
|
||||
continue;
|
||||
}
|
||||
slotIdx = i;
|
||||
break;
|
||||
}
|
||||
if (slotIdx == -1) {
|
||||
recipeTooltipSlotIdx = -1;
|
||||
recipeTooltipGui = null;
|
||||
return;
|
||||
}
|
||||
|
||||
final Point mouseover = getMousePosition();
|
||||
final ItemPanelSlot panelSlot = ItemPanels.bookmarkPanel.getSlotMouseOver(mouseover.x, mouseover.y);
|
||||
final BookmarkRecipeId recipeId;
|
||||
if (panelSlot != null) {
|
||||
recipeId = ItemPanels.bookmarkPanel.getBookmarkRecipeId(panelSlot.slotIndex);
|
||||
} else {
|
||||
recipeId = ItemPanels.bookmarkPanel.getBookmarkRecipeId(focused.item);
|
||||
}
|
||||
if (recipeId == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (slotIdx != recipeTooltipSlotIdx) {
|
||||
recipeTooltipSlotIdx = slotIdx;
|
||||
recipeTooltipGui = null;
|
||||
recipeTooltipUpdater = () -> {
|
||||
recipeTooltipGui = GuiCraftingRecipe.createRecipeGui("item", false, false, false, focused.item);
|
||||
if (recipeTooltipGui != null) {
|
||||
recipeTooltipGui.limitToOneRecipe();
|
||||
recipeTooltipGui.initGui(true);
|
||||
recipeTooltipGui.guiTop = 0;
|
||||
recipeTooltipGui.guiLeft = 0;
|
||||
}
|
||||
recipeTooltipLines = Math.max(1, itemTooltip.size());
|
||||
};
|
||||
}
|
||||
if (recipeTooltipGui == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
final float tooltipYOffset;
|
||||
if (mousey - marginTop > height / 2) {
|
||||
tooltipYOffset = mousey - recipeTooltipGui.getHeightAsWidget() + 8;
|
||||
} else {
|
||||
tooltipYOffset = mousey + ((recipeTooltipLines < 2) ? 1 : 3 + ((recipeTooltipLines - 1) * 10));
|
||||
}
|
||||
GL11.glTranslatef(mousex, tooltipYOffset, 500);
|
||||
|
||||
final GuiContainer gui;
|
||||
if (mc.currentScreen instanceof GuiRecipe) {
|
||||
gui = ((GuiRecipe<?>) mc.currentScreen).firstGui;
|
||||
} else if (mc.currentScreen instanceof GuiContainer) {
|
||||
gui = (GuiContainer) mc.currentScreen;
|
||||
} else {
|
||||
gui = null;
|
||||
}
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
recipeTooltipGui.drawGuiContainerBackgroundLayer(0.0f, -100, -100);
|
||||
GL11.glPopAttrib();
|
||||
if (recipeTooltipGui.slotcontainer != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Slot> slots = (List<Slot>) recipeTooltipGui.slotcontainer.inventorySlots;
|
||||
for (Slot slot : slots) {
|
||||
if (slot != null && slot.getStack() != null) {
|
||||
GuiContainerManager.drawItem(slot.xDisplayPosition, slot.yDisplayPosition, slot.getStack());
|
||||
}
|
||||
}
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
recipeTooltipGui.drawGuiContainerForegroundLayer(-100, -100);
|
||||
for (GuiButton btn : recipeTooltipGui.getOverlayButtons()) {
|
||||
btn.drawButton(mc, -100, -100);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
protected void drawSlotOutline(@Nullable ItemPanelSlot focused, int slotIdx, Rectangle4i rect) {
|
||||
if (focused != null && focused.slotIndex == slotIdx) {
|
||||
drawRect(rect.x, rect.y, rect.w, rect.h, 0xee555555); // highlight
|
||||
@@ -465,16 +329,6 @@ public class ItemsGrid {
|
||||
}
|
||||
}
|
||||
|
||||
public void postDrawTooltips(int mousex, int mousey, List<String> tooltip) {
|
||||
if (NEIClientConfig.showRecipeTooltips() && showRecipeTooltips) {
|
||||
try {
|
||||
drawRecipeTooltip(mousex, mousey, tooltip);
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.warn("Cannot draw recipe tooltip", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setVisible() {
|
||||
if (getItems().isEmpty() && getMessageOnEmpty() != null) {
|
||||
LayoutManager.addWidget(messageLabel);
|
||||
|
||||
@@ -226,10 +226,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
return true;
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.bookmark_pull_items")) {
|
||||
return bookmarkPanel.pullBookmarkItems();
|
||||
}
|
||||
|
||||
if (isEnabled() && !isHidden()) {
|
||||
for (Widget widget : controlWidgets) if (inputFocused == null) widget.lastKeyTyped(keyID, keyChar);
|
||||
}
|
||||
@@ -284,13 +280,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postRenderTooltips(GuiContainer gui, int mousex, int mousey, List<String> tooltip) {
|
||||
if (!isHidden() && isEnabled()) {
|
||||
for (Widget widget : drawWidgets) widget.postDrawTooltips(mousex, mousey, tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
|
||||
if (!isHidden() && isEnabled() && GuiContainerManager.shouldShowTooltip(gui)) {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import static codechicken.nei.PacketIDs.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -22,37 +20,37 @@ public class NEICPH implements IClientPacketHandler {
|
||||
@Override
|
||||
public void handlePacket(PacketCustom packet, Minecraft mc, INetHandlerPlayClient netHandler) {
|
||||
switch (packet.getType()) {
|
||||
case S2C.SEND_SERVER_SIDE_CHECK:
|
||||
case 1:
|
||||
handleSMPCheck(packet.readUByte(), packet.readString(), mc.theWorld);
|
||||
break;
|
||||
case S2C.SEND_LOGIN_STATE:
|
||||
case 10:
|
||||
handleLoginState(packet);
|
||||
break;
|
||||
case S2C.SEND_ACTION_DISABLED:
|
||||
case 11:
|
||||
handleActionDisabled(packet);
|
||||
break;
|
||||
case S2C.SEND_ACTION_ENABLED:
|
||||
case 12:
|
||||
handleActionEnabled(packet);
|
||||
break;
|
||||
case S2C.SEND_MAGNETIC_ITEM:
|
||||
case 13:
|
||||
ClientHandler.instance().addSMPMagneticItem(packet.readInt(), mc.theWorld);
|
||||
break;
|
||||
case S2C.SEND_GAME_MODE:
|
||||
case 14:
|
||||
handleGamemode(mc, packet.readUByte());
|
||||
break;
|
||||
case S2C.OPEN_ENCHANTMENT_GUI:
|
||||
case 21:
|
||||
ClientUtils.openSMPGui(
|
||||
packet.readUByte(),
|
||||
new GuiEnchantmentModifier(mc.thePlayer.inventory, mc.theWorld, 0, 0, 0));
|
||||
break;
|
||||
case S2C.SET_CREATIVE_PLUS_MODE:
|
||||
case 23:
|
||||
if (packet.readBoolean()) ClientUtils.openSMPGui(
|
||||
packet.readUByte(),
|
||||
new GuiExtendedCreativeInv(
|
||||
new ContainerCreativeInv(mc.thePlayer, new ExtendedCreativeInv(null, Side.CLIENT))));
|
||||
else mc.displayGuiScreen(new GuiInventory(mc.thePlayer));
|
||||
break;
|
||||
case S2C.OPEN_POTION_GUI:
|
||||
case 24:
|
||||
ClientUtils.openSMPGui(packet.readUByte(), new GuiPotionCreator(mc.thePlayer.inventory));
|
||||
break;
|
||||
}
|
||||
@@ -104,7 +102,7 @@ public class NEICPH implements IClientPacketHandler {
|
||||
try {
|
||||
ClientHandler.instance().loadWorld(world, true);
|
||||
NEIClientConfig.setHasSMPCounterPart(true);
|
||||
NEIClientConfig.loadWorld(getSaveName());
|
||||
NEIClientConfig.loadWorld(getSaveName(worldName));
|
||||
sendRequestLoginInfo();
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.error("Error handling SMP Check", e);
|
||||
@@ -112,14 +110,14 @@ public class NEICPH implements IClientPacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static String getSaveName() {
|
||||
private static String getSaveName(String worldName) {
|
||||
if (Minecraft.getMinecraft().isSingleplayer()) return "local/" + ClientUtils.getWorldSaveName();
|
||||
|
||||
return "remote/" + ClientUtils.getServerIP().replace(':', '~');
|
||||
return "remote/" + ClientUtils.getServerIP().replace(':', '~') + "/" + worldName;
|
||||
}
|
||||
|
||||
public static void sendGiveItem(ItemStack spawnstack, boolean infinite, boolean doSpawn) {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.GIVE_ITEM);
|
||||
PacketCustom packet = new PacketCustom(channel, 1);
|
||||
packet.writeItemStack(spawnstack, true);
|
||||
packet.writeBoolean(infinite);
|
||||
packet.writeBoolean(doSpawn);
|
||||
@@ -127,7 +125,7 @@ public class NEICPH implements IClientPacketHandler {
|
||||
}
|
||||
|
||||
public static void sendDeleteAllItems() {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.DELETE_ALL_ITEMS);
|
||||
PacketCustom packet = new PacketCustom(channel, 4);
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
@@ -141,18 +139,18 @@ public class NEICPH implements IClientPacketHandler {
|
||||
sendSetSlot(slot, item, false);
|
||||
}
|
||||
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.REQUEST_CONTAINER_CONTENTS);
|
||||
PacketCustom packet = new PacketCustom(channel, 11);
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
public static void sendRequestContainer() {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.REQUEST_CONTAINER);
|
||||
PacketCustom packet = new PacketCustom(channel, 16);
|
||||
packet.writeInt(Minecraft.getMinecraft().thePlayer.openContainer.getInventory().size());
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
public static void sendSetSlot(int slot, ItemStack stack, boolean container) {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.SET_SLOT);
|
||||
PacketCustom packet = new PacketCustom(channel, 5);
|
||||
packet.writeBoolean(container);
|
||||
packet.writeShort(slot);
|
||||
packet.writeItemStack(stack);
|
||||
@@ -160,38 +158,38 @@ public class NEICPH implements IClientPacketHandler {
|
||||
}
|
||||
|
||||
private static void sendRequestLoginInfo() {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.REQUEST_LOGIN_INFO);
|
||||
PacketCustom packet = new PacketCustom(channel, 10);
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
public static void sendToggleMagnetMode() {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.TOGGLE_MAGNET);
|
||||
PacketCustom packet = new PacketCustom(channel, 6);
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
public static void sendSetTime(int hour) {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.SET_TIME);
|
||||
PacketCustom packet = new PacketCustom(channel, 7);
|
||||
packet.writeByte(hour);
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
public static void sendHeal() {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.HEAL);
|
||||
PacketCustom packet = new PacketCustom(channel, 8);
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
public static void sendToggleRain() {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.TOGGLE_RAIN);
|
||||
PacketCustom packet = new PacketCustom(channel, 9);
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
public static void sendOpenEnchantmentWindow() {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.REQUEST_ENCHANTMENT_GUI);
|
||||
PacketCustom packet = new PacketCustom(channel, 21);
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
public static void sendModifyEnchantment(int enchID, int level, boolean add) {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.MODIFY_ENCHANTMENT);
|
||||
PacketCustom packet = new PacketCustom(channel, 22);
|
||||
packet.writeByte(enchID);
|
||||
packet.writeByte(level);
|
||||
packet.writeBoolean(add);
|
||||
@@ -199,30 +197,30 @@ public class NEICPH implements IClientPacketHandler {
|
||||
}
|
||||
|
||||
public static void sendSetPropertyDisabled(String name, boolean enable) {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.CHANGE_PROPERTY);
|
||||
PacketCustom packet = new PacketCustom(channel, 12);
|
||||
packet.writeString(name);
|
||||
packet.writeBoolean(enable);
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
public static void sendGamemode(int mode) {
|
||||
new PacketCustom(channel, C2S.SET_GAME_MODE).writeByte(mode).sendToServer();
|
||||
new PacketCustom(channel, 13).writeByte(mode).sendToServer();
|
||||
}
|
||||
|
||||
public static void sendCreativeInv(boolean open) {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.SET_CREATIVE_PLUS_MODE);
|
||||
PacketCustom packet = new PacketCustom(channel, 23);
|
||||
packet.writeBoolean(open);
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
public static void sendCreativeScroll(int steps) {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.CYCLE_CREATIVE_INV);
|
||||
PacketCustom packet = new PacketCustom(channel, 14);
|
||||
packet.writeInt(steps);
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
public static void sendMobSpawnerID(int x, int y, int z, String mobtype) {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.SEND_MOB_SPAWNER_ID);
|
||||
PacketCustom packet = new PacketCustom(channel, 15);
|
||||
packet.writeCoord(x, y, z);
|
||||
packet.writeString(mobtype);
|
||||
packet.sendToServer();
|
||||
@@ -233,13 +231,13 @@ public class NEICPH implements IClientPacketHandler {
|
||||
InventoryUtils.readItemStacksFromTag(
|
||||
potionStore,
|
||||
NEIClientConfig.global.nbt.getCompoundTag("potionStore").getTagList("items", 10));
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.REQUEST_POTION_GUI);
|
||||
PacketCustom packet = new PacketCustom(channel, 24);
|
||||
for (ItemStack stack : potionStore) packet.writeItemStack(stack);
|
||||
packet.sendToServer();
|
||||
}
|
||||
|
||||
public static void sendDummySlotSet(int slotNumber, ItemStack stack) {
|
||||
PacketCustom packet = new PacketCustom(channel, C2S.SET_DUMMY_SLOT);
|
||||
PacketCustom packet = new PacketCustom(channel, 25);
|
||||
packet.writeShort(slotNumber);
|
||||
packet.writeItemStack(stack, true);
|
||||
packet.sendToServer();
|
||||
|
||||
@@ -242,9 +242,6 @@ public class NEIClientConfig {
|
||||
tag.getTag("inventory.bookmarksAnimationEnabled").setComment("REI Style Animation in Bookmarks")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.bookmarksAnimationEnabled", true));
|
||||
tag.getTag("inventory.recipeTooltipsEnabled").setComment("Show recipe tooltips in Bookmarks")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.recipeTooltipsEnabled", true));
|
||||
tag.getTag("inventory.showRecipeMarker").setComment("Show Recipe Marker").getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.showRecipeMarker", true));
|
||||
|
||||
@@ -354,7 +351,6 @@ public class NEIClientConfig {
|
||||
API.addHashBind(
|
||||
"gui.bookmark_recipe_count",
|
||||
Keyboard.KEY_A + NEIClientUtils.SHIFT_HASH + NEIClientUtils.CTRL_HASH);
|
||||
API.addHashBind("gui.bookmark_pull_items", Keyboard.KEY_V);
|
||||
API.addHashBind("gui.overlay", Keyboard.KEY_S);
|
||||
API.addHashBind("gui.overlay_use", Keyboard.KEY_S + NEIClientUtils.SHIFT_HASH);
|
||||
API.addHashBind("gui.overlay_hide", Keyboard.KEY_S + NEIClientUtils.CTRL_HASH);
|
||||
@@ -477,7 +473,7 @@ public class NEIClientConfig {
|
||||
LayoutManager.load();
|
||||
NEIController.load();
|
||||
RecipeCatalysts.loadCatalystInfo();
|
||||
BookmarkContainerInfo.load();
|
||||
|
||||
mainNEIConfigLoaded = true;
|
||||
|
||||
new Thread("NEI Plugin Loader") {
|
||||
@@ -563,10 +559,6 @@ public class NEIClientConfig {
|
||||
return getBooleanSetting("inventory.bookmarksAnimationEnabled");
|
||||
}
|
||||
|
||||
public static boolean showRecipeTooltips() {
|
||||
return getBooleanSetting("inventory.recipeTooltipsEnabled");
|
||||
}
|
||||
|
||||
public static boolean showRecipeMarker() {
|
||||
return getBooleanSetting("inventory.showRecipeMarker");
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import static codechicken.nei.PacketIDs.*;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -30,61 +28,61 @@ public class NEISPH implements IServerPacketHandler {
|
||||
if (!NEIServerConfig.authenticatePacket(sender, packet)) return;
|
||||
|
||||
switch (packet.getType()) {
|
||||
case C2S.GIVE_ITEM:
|
||||
case 1:
|
||||
handleGiveItem(sender, packet);
|
||||
break;
|
||||
case C2S.DELETE_ALL_ITEMS:
|
||||
case 4:
|
||||
NEIServerUtils.deleteAllItems(sender);
|
||||
break;
|
||||
case C2S.SET_SLOT:
|
||||
case 5:
|
||||
setInventorySlot(sender, packet);
|
||||
break;
|
||||
case C2S.TOGGLE_MAGNET:
|
||||
case 6:
|
||||
NEIServerUtils.toggleMagnetMode(sender);
|
||||
break;
|
||||
case C2S.SET_TIME:
|
||||
case 7:
|
||||
NEIServerUtils.setHourForward(sender.worldObj, packet.readUByte(), true);
|
||||
break;
|
||||
case C2S.HEAL:
|
||||
case 8:
|
||||
NEIServerUtils.healPlayer(sender);
|
||||
break;
|
||||
case C2S.TOGGLE_RAIN:
|
||||
case 9:
|
||||
NEIServerUtils.toggleRaining(sender.worldObj, true);
|
||||
break;
|
||||
case C2S.REQUEST_LOGIN_INFO:
|
||||
case 10:
|
||||
sendLoginState(sender);
|
||||
break;
|
||||
case C2S.REQUEST_CONTAINER_CONTENTS:
|
||||
case 11:
|
||||
sender.sendContainerAndContentsToPlayer(sender.openContainer, sender.openContainer.getInventory());
|
||||
break;
|
||||
case C2S.CHANGE_PROPERTY:
|
||||
case 12:
|
||||
handlePropertyChange(sender, packet);
|
||||
break;
|
||||
case C2S.SET_GAME_MODE:
|
||||
case 13:
|
||||
NEIServerUtils.setGamemode(sender, packet.readUByte());
|
||||
break;
|
||||
case C2S.CYCLE_CREATIVE_INV:
|
||||
case 14:
|
||||
NEIServerUtils.cycleCreativeInv(sender, packet.readInt());
|
||||
break;
|
||||
case C2S.SEND_MOB_SPAWNER_ID:
|
||||
case 15:
|
||||
handleMobSpawnerID(sender.worldObj, packet.readCoord(), packet.readString());
|
||||
break;
|
||||
case C2S.REQUEST_CONTAINER:
|
||||
case 16:
|
||||
handleRequestContainer(sender, packet.readInt());
|
||||
break;
|
||||
case C2S.REQUEST_ENCHANTMENT_GUI:
|
||||
case 21:
|
||||
openEnchantmentGui(sender);
|
||||
break;
|
||||
case C2S.MODIFY_ENCHANTMENT:
|
||||
case 22:
|
||||
modifyEnchantment(sender, packet.readUByte(), packet.readUByte(), packet.readBoolean());
|
||||
break;
|
||||
case C2S.SET_CREATIVE_PLUS_MODE:
|
||||
case 23:
|
||||
processCreativeInv(sender, packet.readBoolean());
|
||||
break;
|
||||
case C2S.REQUEST_POTION_GUI:
|
||||
case 24:
|
||||
openPotionGui(sender, packet);
|
||||
break;
|
||||
case C2S.SET_DUMMY_SLOT:
|
||||
case 25:
|
||||
handleDummySlotSet(sender, packet);
|
||||
break;
|
||||
}
|
||||
@@ -128,14 +126,14 @@ public class NEISPH implements IServerPacketHandler {
|
||||
NEIServerConfig.forPlayer(sender.getCommandSenderName()),
|
||||
Side.SERVER)),
|
||||
(player, windowId) -> {
|
||||
PacketCustom packet = new PacketCustom(channel, S2C.SET_CREATIVE_PLUS_MODE);
|
||||
PacketCustom packet = new PacketCustom(channel, 23);
|
||||
packet.writeBoolean(true);
|
||||
packet.writeByte(windowId);
|
||||
packet.sendToPlayer(player);
|
||||
});
|
||||
} else {
|
||||
sender.closeContainer();
|
||||
PacketCustom packet = new PacketCustom(channel, S2C.SET_CREATIVE_PLUS_MODE);
|
||||
PacketCustom packet = new PacketCustom(channel, 23);
|
||||
packet.writeBoolean(false);
|
||||
packet.sendToPlayer(sender);
|
||||
}
|
||||
@@ -171,7 +169,7 @@ public class NEISPH implements IServerPacketHandler {
|
||||
player,
|
||||
new ContainerEnchantmentModifier(player.inventory, player.worldObj, 0, 0, 0),
|
||||
(player1, windowId) -> {
|
||||
PacketCustom packet = new PacketCustom(channel, S2C.OPEN_ENCHANTMENT_GUI);
|
||||
PacketCustom packet = new PacketCustom(channel, 21);
|
||||
packet.writeByte(windowId);
|
||||
packet.sendToPlayer(player1);
|
||||
});
|
||||
@@ -181,19 +179,18 @@ public class NEISPH implements IServerPacketHandler {
|
||||
InventoryBasic b = new InventoryBasic("potionStore", true, 9);
|
||||
for (int i = 0; i < b.getSizeInventory(); i++) b.setInventorySlotContents(i, packet.readItemStack());
|
||||
ServerUtils.openSMPContainer(player, new ContainerPotionCreator(player.inventory, b), (player1, windowId) -> {
|
||||
PacketCustom packet1 = new PacketCustom(channel, S2C.OPEN_POTION_GUI);
|
||||
PacketCustom packet1 = new PacketCustom(channel, 24);
|
||||
packet1.writeByte(windowId);
|
||||
packet1.sendToPlayer(player1);
|
||||
});
|
||||
}
|
||||
|
||||
public static void sendActionDisabled(int dim, String name, boolean disable) {
|
||||
new PacketCustom(channel, S2C.SEND_ACTION_DISABLED).writeString(name).writeBoolean(disable)
|
||||
.sendToDimension(dim);
|
||||
new PacketCustom(channel, 11).writeString(name).writeBoolean(disable).sendToDimension(dim);
|
||||
}
|
||||
|
||||
public static void sendActionEnabled(EntityPlayerMP player, String name, boolean enable) {
|
||||
new PacketCustom(channel, S2C.SEND_ACTION_ENABLED).writeString(name).writeBoolean(enable).sendToPlayer(player);
|
||||
new PacketCustom(channel, 12).writeString(name).writeBoolean(enable).sendToPlayer(player);
|
||||
}
|
||||
|
||||
private void sendLoginState(EntityPlayerMP player) {
|
||||
@@ -212,7 +209,7 @@ public class NEISPH implements IServerPacketHandler {
|
||||
if (!NEIServerConfig.isPlayerInList(player.getCommandSenderName(), entry.value, true))
|
||||
bannedItems.add(entry.key);
|
||||
|
||||
PacketCustom packet = new PacketCustom(channel, S2C.SEND_LOGIN_STATE);
|
||||
PacketCustom packet = new PacketCustom(channel, 10);
|
||||
|
||||
packet.writeByte(actions.size());
|
||||
for (String s : actions) packet.writeString(s);
|
||||
@@ -231,7 +228,7 @@ public class NEISPH implements IServerPacketHandler {
|
||||
|
||||
public static void sendHasServerSideTo(EntityPlayerMP player) {
|
||||
NEIServerConfig.logger.debug("Sending serverside check to: " + player.getCommandSenderName());
|
||||
PacketCustom packet = new PacketCustom(channel, S2C.SEND_SERVER_SIDE_CHECK);
|
||||
PacketCustom packet = new PacketCustom(channel, 1);
|
||||
packet.writeByte(NEIActions.protocol);
|
||||
packet.writeString(CommonUtils.getWorldName(player.worldObj));
|
||||
|
||||
@@ -239,7 +236,7 @@ public class NEISPH implements IServerPacketHandler {
|
||||
}
|
||||
|
||||
public static void sendAddMagneticItemTo(EntityPlayerMP player, EntityItem item) {
|
||||
PacketCustom packet = new PacketCustom(channel, S2C.SEND_MAGNETIC_ITEM);
|
||||
PacketCustom packet = new PacketCustom(channel, 13);
|
||||
packet.writeInt(item.getEntityId());
|
||||
|
||||
packet.sendToPlayer(player);
|
||||
|
||||
@@ -42,7 +42,6 @@ import codechicken.core.ServerUtils;
|
||||
import codechicken.lib.inventory.InventoryRange;
|
||||
import codechicken.lib.inventory.InventoryUtils;
|
||||
import codechicken.lib.packet.PacketCustom;
|
||||
import codechicken.nei.PacketIDs.S2C;
|
||||
import codechicken.nei.util.NBTHelper;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@@ -296,7 +295,7 @@ public class NEIServerUtils {
|
||||
player.theItemInWorldManager.setGameType(getGameType(mode));
|
||||
|
||||
// tell the client to change it
|
||||
new PacketCustom(NEISPH.channel, S2C.SEND_GAME_MODE).writeByte(mode).sendToPlayer(player);
|
||||
new PacketCustom(NEISPH.channel, 14).writeByte(mode).sendToPlayer(player);
|
||||
player.addChatMessage(new ChatComponentTranslation("nei.chat.gamemode." + mode));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package codechicken.nei;
|
||||
|
||||
public final class PacketIDs {
|
||||
|
||||
public static final class C2S {
|
||||
|
||||
public static final int GIVE_ITEM = 1;
|
||||
public static final int DELETE_ALL_ITEMS = 4;
|
||||
public static final int SET_SLOT = 5;
|
||||
public static final int TOGGLE_MAGNET = 6;
|
||||
public static final int SET_TIME = 7;
|
||||
public static final int HEAL = 8;
|
||||
public static final int TOGGLE_RAIN = 9;
|
||||
public static final int REQUEST_LOGIN_INFO = 10;
|
||||
public static final int REQUEST_CONTAINER_CONTENTS = 11;
|
||||
public static final int CHANGE_PROPERTY = 12;
|
||||
public static final int SET_GAME_MODE = 13;
|
||||
public static final int CYCLE_CREATIVE_INV = 14;
|
||||
public static final int SEND_MOB_SPAWNER_ID = 15;
|
||||
public static final int REQUEST_CONTAINER = 16;
|
||||
public static final int REQUEST_ENCHANTMENT_GUI = 21;
|
||||
public static final int MODIFY_ENCHANTMENT = 22;
|
||||
public static final int SET_CREATIVE_PLUS_MODE = 23;
|
||||
public static final int REQUEST_POTION_GUI = 24;
|
||||
public static final int SET_DUMMY_SLOT = 25;
|
||||
}
|
||||
|
||||
public static final class S2C {
|
||||
|
||||
public static final int SEND_SERVER_SIDE_CHECK = 1;
|
||||
public static final int SEND_LOGIN_STATE = 10;
|
||||
public static final int SEND_ACTION_DISABLED = 11;
|
||||
public static final int SEND_ACTION_ENABLED = 12;
|
||||
public static final int SEND_MAGNETIC_ITEM = 13;
|
||||
public static final int SEND_GAME_MODE = 14;
|
||||
public static final int OPEN_ENCHANTMENT_GUI = 21;
|
||||
public static final int SET_CREATIVE_PLUS_MODE = 23;
|
||||
public static final int OPEN_POTION_GUI = 24;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -172,11 +171,6 @@ public abstract class PanelWidget extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
grid.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey) {
|
||||
grid.draw(mousex, mousey);
|
||||
@@ -191,11 +185,6 @@ public abstract class PanelWidget extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDrawTooltips(int mx, int my, List<String> tooltip) {
|
||||
grid.postDrawTooltips(mx, my, tooltip);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(int mousex, int mousey, int button, long heldTime) {
|
||||
if (mouseDownSlot >= 0 && draggedStack == null
|
||||
|
||||
@@ -14,8 +14,6 @@ public abstract class Widget {
|
||||
|
||||
public void postDraw(int mx, int my) {}
|
||||
|
||||
public void postDrawTooltips(int mx, int my, List<String> tooltip) {}
|
||||
|
||||
public boolean handleClick(int mx, int my, int button) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import codechicken.nei.BookmarkContainerInfo;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.ItemSorter;
|
||||
import codechicken.nei.ItemStackSet;
|
||||
@@ -391,11 +390,6 @@ public class API {
|
||||
RecipeCatalysts.removeRecipeCatalyst(handlerID, stack);
|
||||
}
|
||||
|
||||
public static void registerBookmarkContainerHandler(Class<? extends GuiContainer> gui,
|
||||
IBookmarkContainerHandler handler) {
|
||||
BookmarkContainerInfo.registerBookmarkContainerHandler(gui, handler);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void addRecipeCatalyst(List<ItemStack> stacks, IRecipeHandler handler) {
|
||||
for (ItemStack stack : stacks) {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IBookmarkContainerHandler {
|
||||
|
||||
void pullBookmarkItemsFromContainer(GuiContainer guiContainer, ArrayList<ItemStack> realItems);
|
||||
}
|
||||
@@ -20,10 +20,6 @@ public abstract class ShortcutInputHandler {
|
||||
|
||||
public static boolean handleKeyEvent(ItemStack stackover) {
|
||||
|
||||
if (!NEIClientConfig.isLoaded()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.overlay_hide")) {
|
||||
return hideOverlayRecipe();
|
||||
}
|
||||
@@ -71,10 +67,6 @@ public abstract class ShortcutInputHandler {
|
||||
|
||||
public static boolean handleMouseClick(ItemStack stackover) {
|
||||
|
||||
if (!NEIClientConfig.isLoaded()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stackover != null) {
|
||||
final int button = Mouse.getEventButton();
|
||||
stackover = stackover.copy();
|
||||
|
||||
@@ -135,6 +135,13 @@ public class IMCHandler {
|
||||
NEIClientConfig.logger.warn("Missing handlerID for registerCatalystInfo!");
|
||||
return;
|
||||
}
|
||||
final String modId = tag.hasKey("modId") ? tag.getString("modId") : null;
|
||||
final boolean requiresMod = tag.getBoolean("modRequired");
|
||||
final String excludedModId = tag.hasKey("excludedModId") ? tag.getString("excludedModId") : null;
|
||||
|
||||
if (requiresMod && modId != null && !Loader.isModLoaded(modId)) return;
|
||||
if (excludedModId != null && Loader.isModLoaded(excludedModId)) return;
|
||||
|
||||
final String itemName = tag.getString("itemName");
|
||||
final String nbtInfo = tag.hasKey("nbtInfo") ? tag.getString("nbtInfo") : null;
|
||||
if (itemName.isEmpty()) {
|
||||
@@ -170,7 +177,7 @@ public class IMCHandler {
|
||||
final String itemName = tag.getString("itemName");
|
||||
final String nbtInfo = tag.hasKey("nbtInfo") ? tag.getString("nbtInfo") : null;
|
||||
if (itemName.isEmpty()) {
|
||||
NEIClientConfig.logger.warn(String.format("Missing itemName for registerCatalystInfo in `%s`!", handlerID));
|
||||
NEIClientConfig.logger.warn(String.format("Missing itemName for removeCatalystInfo in `%s`!", handlerID));
|
||||
return;
|
||||
}
|
||||
final ItemStack itemStack = NEIServerUtils.getModdedItem(itemName, nbtInfo);
|
||||
|
||||
@@ -514,10 +514,6 @@ public class GuiContainerManager {
|
||||
if (tooltip.size() > 0) tooltip.set(0, tooltip.get(0) + GuiDraw.TOOLTIP_LINESPACE); // add space after 'title'
|
||||
|
||||
drawPagedTooltip(font, mousex + 12, mousey - 12, tooltip);
|
||||
|
||||
for (IContainerDrawHandler drawHandler : drawHandlers) {
|
||||
drawHandler.postRenderTooltips(window, mousex, mousey, tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
private static int tooltipPage;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package codechicken.nei.guihook;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
@@ -32,17 +30,6 @@ public interface IContainerDrawHandler {
|
||||
*/
|
||||
public void postRenderObjects(GuiContainer gui, int mousex, int mousey);
|
||||
|
||||
/**
|
||||
* Use this to draw things that should be drawn just after vanilla slot tooltips, on top of buttons and other
|
||||
* usually always-on-top widgets.
|
||||
*
|
||||
* @param gui An instance of the currentscreen
|
||||
* @param mousex The x position of the mouse in pixels from left
|
||||
* @param mousey The y position of the mouse in pixels from top
|
||||
* @param tooltip The contents of the tooltip that has previously been drawn
|
||||
*/
|
||||
default void postRenderTooltips(GuiContainer gui, int mousex, int mousey, List<String> tooltip) {}
|
||||
|
||||
/**
|
||||
* Render something over a slot before the item in the slot.
|
||||
*
|
||||
|
||||
@@ -121,43 +121,6 @@ public class BookmarkRecipeId {
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures the {@link BookmarkRecipeId#recipetype} and {@link BookmarkRecipeId#position} fields point to a valid
|
||||
* recipe. This is needed, because the recipe IDs are loaded lazily on first use.
|
||||
*
|
||||
* @param recipeHandlers The subset of recipe handlers to search for the recipe
|
||||
*/
|
||||
public void updateTargetRecipe(List<? extends IRecipeHandler> recipeHandlers) {
|
||||
if (this.recipetype == -1 || this.position == -1) {
|
||||
this.recipetype = 0;
|
||||
this.position = 0;
|
||||
|
||||
if (this.handlerName != null) {
|
||||
|
||||
for (int j = 0; j < recipeHandlers.size(); j++) {
|
||||
IRecipeHandler localHandler = recipeHandlers.get(j);
|
||||
HandlerInfo localHandlerInfo = GuiRecipeTab.getHandlerInfo(localHandler);
|
||||
|
||||
if (localHandlerInfo.getHandlerName().equals(this.handlerName)) {
|
||||
|
||||
if (!this.ingredients.isEmpty()) {
|
||||
for (int i = 0; i < localHandler.numRecipes(); i++) {
|
||||
|
||||
if (this.equalsIngredients(localHandler.getIngredientStacks(i))) {
|
||||
this.recipetype = j;
|
||||
this.position = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean equals(Object anObject) {
|
||||
if (this == anObject) {
|
||||
return true;
|
||||
|
||||
@@ -28,27 +28,28 @@ public class GuiCraftingRecipe extends GuiRecipe<ICraftingHandler> {
|
||||
|
||||
public static boolean openRecipeGui(String outputId, final Boolean overlay, final Boolean shift,
|
||||
Object... results) {
|
||||
return createRecipeGui(outputId, overlay, shift, true, results) != null;
|
||||
}
|
||||
|
||||
public static GuiRecipe<?> createRecipeGui(String outputId, final Boolean overlay, final Boolean shift,
|
||||
final boolean open, Object... results) {
|
||||
final Minecraft mc = NEIClientUtils.mc();
|
||||
|
||||
final BookmarkRecipeId recipeId = "item".equals(outputId)
|
||||
? getRecipeId(mc.currentScreen, (ItemStack) results[0])
|
||||
: getCurrentRecipe(mc.currentScreen);
|
||||
|
||||
if (overlay && recipeId == null) return null;
|
||||
if (overlay && recipeId == null) return false;
|
||||
|
||||
final ArrayList<ICraftingHandler> handlers = getCraftingHandlers(outputId, results);
|
||||
final RecipeHandlerQuery<ICraftingHandler> recipeQuery = new RecipeHandlerQuery<>(
|
||||
h -> h.getRecipeHandler(outputId, results),
|
||||
craftinghandlers,
|
||||
serialCraftingHandlers,
|
||||
"Error while looking up crafting recipe",
|
||||
"outputId: " + outputId,
|
||||
"results: " + Arrays.toString(results));
|
||||
|
||||
final ArrayList<ICraftingHandler> handlers = recipeQuery.runWithProfiling("recipe.concurrent.crafting");
|
||||
|
||||
if (!handlers.isEmpty()) {
|
||||
GuiCraftingRecipe gui = new GuiCraftingRecipe(handlers, recipeId);
|
||||
|
||||
if (open) {
|
||||
mc.displayGuiScreen(gui);
|
||||
}
|
||||
mc.displayGuiScreen(gui);
|
||||
|
||||
if (recipeId != null) {
|
||||
gui.openTargetRecipe(gui.recipeId);
|
||||
@@ -58,22 +59,10 @@ public class GuiCraftingRecipe extends GuiRecipe<ICraftingHandler> {
|
||||
gui.overlayRecipe(gui.recipeId.position, shift);
|
||||
}
|
||||
|
||||
return gui;
|
||||
return true;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ArrayList<ICraftingHandler> getCraftingHandlers(String outputId, Object... results) {
|
||||
final RecipeHandlerQuery<ICraftingHandler> recipeQuery = new RecipeHandlerQuery<>(
|
||||
h -> h.getRecipeHandler(outputId, results),
|
||||
craftinghandlers,
|
||||
serialCraftingHandlers,
|
||||
"Error while looking up crafting recipe",
|
||||
"outputId: " + outputId,
|
||||
"results: " + Arrays.toString(results));
|
||||
|
||||
return recipeQuery.runWithProfiling("recipe.concurrent.crafting");
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static BookmarkRecipeId getRecipeId(GuiScreen gui, ItemStack stackover) {
|
||||
@@ -105,7 +94,6 @@ public class GuiCraftingRecipe extends GuiRecipe<ICraftingHandler> {
|
||||
|
||||
public static void registerRecipeHandler(ICraftingHandler handler) {
|
||||
final String handlerId = handler.getHandlerId();
|
||||
|
||||
if (craftinghandlers.stream().anyMatch(h -> h.getHandlerId().equals(handlerId))
|
||||
|| serialCraftingHandlers.stream().anyMatch(h -> h.getHandlerId().equals(handlerId)))
|
||||
return;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
@@ -15,7 +13,6 @@ import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
@@ -62,8 +59,6 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
private static final int buttonWidth = 13;
|
||||
private static final int buttonHeight = 12;
|
||||
|
||||
private boolean limitToOneRecipe = false;
|
||||
|
||||
// Background image
|
||||
final DrawableResource bgTop = new DrawableBuilder("nei:textures/gui/recipebg.png", 0, BG_TOP_Y, 176, BG_TOP_HEIGHT)
|
||||
.build();
|
||||
@@ -105,10 +100,6 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
private int yShift = 0;
|
||||
|
||||
/**
|
||||
* This will only be true iff height hacking has been configured for the current recipe handler AND we are currently
|
||||
* within the scope of an active {@link CompatibilityHacks} instance.
|
||||
*/
|
||||
private boolean isHeightHackApplied = false;
|
||||
|
||||
protected GuiRecipe(GuiScreen prevgui) {
|
||||
@@ -127,39 +118,21 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
}
|
||||
|
||||
/** Changes the GUI mode to only display one recipe at a time, e.g. for tooltip usage */
|
||||
public void limitToOneRecipe() {
|
||||
limitToOneRecipe = true;
|
||||
}
|
||||
|
||||
/** Checks if the gui only displays one recipe at a time, e.g. for tooltip usage */
|
||||
public boolean isLimitedToOneRecipe() {
|
||||
return limitToOneRecipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Many old mods assumed a fixed NEI window height of {@code 166} pixels. Now that this is no longer the case, their
|
||||
* tooltip and click zone handling is broken. This helper class fixes these old mods by hacking the {@link #height}
|
||||
* property's value so that these old mods' calculations return the correct value for the new height.
|
||||
*
|
||||
* <p>
|
||||
* New and old mods often assume that the handler is only drawn when {@link GuiRecipe} is the currently active
|
||||
* screen in {@link net.minecraft.client.Minecraft}. This is no longer true since the addition of recipe tooltips
|
||||
* which need to render the recipe in other containers on mouse hover, this class temporarily switches the active
|
||||
* screen to {@code this} while rendering them to avoid ClassCastExceptions and other similar crashes.
|
||||
*
|
||||
* <p>
|
||||
* This class is an {@link AutoCloseable} so that it can be used with try-with-resources, which will ensure that
|
||||
* {@link #height} and {@link net.minecraft.client.Minecraft#currentScreen} is returned to the correct value
|
||||
* afterwards.
|
||||
* {@link #height} is returned to the correct value afterwards.
|
||||
*/
|
||||
private class CompatibilityHacks implements AutoCloseable {
|
||||
private class HeightHack implements AutoCloseable {
|
||||
|
||||
private final int trueHeight;
|
||||
private final int trueGuiTop;
|
||||
private final GuiScreen trueGui;
|
||||
|
||||
private CompatibilityHacks() {
|
||||
private HeightHack() {
|
||||
trueHeight = height;
|
||||
trueGuiTop = guiTop;
|
||||
|
||||
@@ -167,18 +140,18 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
.map(pattern -> pattern.matcher(handler.getHandlerId())).anyMatch(Matcher::matches);
|
||||
if (isHeightHackApplied) {
|
||||
// guiTop is the top edge of the recipe screen on the y-axis. Old recipe handlers expect a single paging
|
||||
// widget at the top and at the bottom of the recipe screen with a height of 16px each, but GTNH NEI
|
||||
// moved the bottom paging widget to the top following JEI's design, increasing the "forbidden" zone at
|
||||
// the top to 32px. To fix these old recipe handlers we move guiTop down 16px so that they can keep
|
||||
// working with the old 16px gap.
|
||||
// widget at the top and at the bottom of the recipe screen with a height of 16px, but GTNH NEI move the
|
||||
// bottom paging widget to the top following JEI's UI increasing the forbidden zone at the top to 32px.
|
||||
// To fix these old recipe handlers we move guiTop down 16px so that they can keep working with the old
|
||||
// 16px gap.
|
||||
guiTop += 16;
|
||||
|
||||
// The old NEI recipe screen had a fixed width and height and was always centered on the screen. Legacy
|
||||
// recipe handlers use the calculation ((height - 166) / 2) to compute the y-value of the top edge of
|
||||
// the NEI window. GTNH NEI changes the layout so that the recipe screen length now has a flexible
|
||||
// length and is no longer centered vertically. In order for the top-of-screen calculation to return the
|
||||
// correct result, we have to hack the height field with an inverse of the calculation using the actual
|
||||
// top of the recipe screen stored in guiTop.
|
||||
// the NEI recipe screen. GTNH NEI now has a flexible recipe screen length and is no longer centered
|
||||
// vertically, so in order for the top-of-screen calculation to return the correct result, we have to
|
||||
// hack the height field with an inverse of the calculation using the actual top of the recipe screen
|
||||
// stored in guiTop.
|
||||
height = (2 * guiTop) + 166;
|
||||
|
||||
// For reference, in case we ever need to modify width as well:
|
||||
@@ -187,53 +160,22 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
// as well, we'd do this:
|
||||
// width = (2 * guiWidth) + 176;
|
||||
}
|
||||
|
||||
// Recipe handlers may assume the current screen is the GuiRecipe object, which is not the case in
|
||||
// recipe tooltips drawn on the bookmarks panel with the main inventory open.
|
||||
trueGui = NEIClientUtils.mc().currentScreen;
|
||||
if (limitToOneRecipe) {
|
||||
NEIClientUtils.mc().currentScreen = GuiRecipe.this;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
guiTop = trueGuiTop;
|
||||
height = trueHeight;
|
||||
|
||||
// Only restore currentScreen if it hasn't been altered by a recipe handler (for example through
|
||||
// Minecraft#displayGuiScreen).
|
||||
if (limitToOneRecipe && NEIClientUtils.mc().currentScreen == GuiRecipe.this) {
|
||||
NEIClientUtils.mc().currentScreen = trueGui;
|
||||
}
|
||||
|
||||
isHeightHackApplied = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
initGui(false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui(boolean asWidget) {
|
||||
public void initGui() {
|
||||
xSize = 176;
|
||||
ySize = Math.min(Math.max(height - 68, 166), 370);
|
||||
if (!asWidget) {
|
||||
super.initGui();
|
||||
} else {
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.ySize = this.getHeightAsWidget();
|
||||
this.mc = NEIClientUtils.mc();
|
||||
this.fontRendererObj = mc.fontRenderer;
|
||||
ScaledResolution scaledresolution = new ScaledResolution(
|
||||
this.mc,
|
||||
this.mc.displayWidth,
|
||||
this.mc.displayHeight);
|
||||
this.width = scaledresolution.getScaledWidth();
|
||||
this.height = scaledresolution.getScaledHeight();
|
||||
}
|
||||
super.initGui();
|
||||
guiTop = (height - ySize) / 2 + 10;
|
||||
currenthandlers = getCurrentRecipeHandlers(); // Probably don't comment me out
|
||||
|
||||
@@ -270,24 +212,14 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
overlayButtons = new GuiButton[recipesPerPage];
|
||||
final int xOffset = limitToOneRecipe ? ((xSize / 2) - 2) : (width / 2);
|
||||
final int yOffset = limitToOneRecipe ? 0 : guiTop - 18;
|
||||
final String overlayKeyName = NEIClientConfig
|
||||
.getKeyName(NEIClientConfig.getKeyBinding("gui.overlay_use"), true);
|
||||
for (int i = 0; i < recipesPerPage; i++) {
|
||||
overlayButtons[i] = new GuiNEIButton(
|
||||
OVERLAY_BUTTON_ID_START + i,
|
||||
xOffset + 65,
|
||||
yOffset + getRecipePosition(i).y + handlerInfo.getHeight(),
|
||||
(width / 2) + 65,
|
||||
guiTop + 16 + (handlerInfo.getHeight() * (i + 1)) - 2,
|
||||
buttonWidth,
|
||||
buttonHeight,
|
||||
"?");
|
||||
if (overlayKeyName != null && limitToOneRecipe) {
|
||||
overlayButtons[i].visible = true;
|
||||
overlayButtons[i].displayString = overlayKeyName;
|
||||
overlayButtons[i].width = fontRenderer.getStringWidth(overlayKeyName) + 6;
|
||||
overlayButtons[i].xPosition = xOffset + 85 - overlayButtons[i].width;
|
||||
}
|
||||
}
|
||||
Collections.addAll(buttonList, overlayButtons);
|
||||
itemPresenceCacheRecipe = -1;
|
||||
@@ -314,17 +246,41 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
initOverlayButtons();
|
||||
}
|
||||
|
||||
public List<GuiButton> getOverlayButtons() {
|
||||
return Collections.unmodifiableList(Arrays.asList(overlayButtons));
|
||||
}
|
||||
|
||||
public void openTargetRecipe(BookmarkRecipeId recipeId) {
|
||||
|
||||
if (recipeId == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
recipeId.updateTargetRecipe(currenthandlers);
|
||||
if (recipeId.recipetype == -1 || recipeId.position == -1) {
|
||||
recipeId.recipetype = 0;
|
||||
recipeId.position = 0;
|
||||
|
||||
if (recipeId.handlerName != null) {
|
||||
|
||||
for (int j = 0; j < currenthandlers.size(); j++) {
|
||||
H localHandler = currenthandlers.get(j);
|
||||
HandlerInfo localHandlerInfo = GuiRecipeTab.getHandlerInfo(localHandler);
|
||||
|
||||
if (localHandlerInfo.getHandlerName().equals(recipeId.handlerName)) {
|
||||
|
||||
if (!recipeId.ingredients.isEmpty()) {
|
||||
for (int i = 0; i < localHandler.numRecipes(); i++) {
|
||||
|
||||
if (recipeId.equalsIngredients(localHandler.getIngredientStacks(i))) {
|
||||
recipeId.recipetype = j;
|
||||
recipeId.position = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setRecipePage(recipeId.recipetype, recipeId.position);
|
||||
}
|
||||
|
||||
@@ -408,7 +364,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
if (GuiContainerManager.getManager(this).lastKeyTyped(i, c)) return;
|
||||
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
try (HeightHack heightHack = new HeightHack()) {
|
||||
for (int recipe : getRecipeIndices()) if (handler.keyTyped(this, c, i, recipe)) return;
|
||||
}
|
||||
|
||||
@@ -430,7 +386,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
try (HeightHack heightHack = new HeightHack()) {
|
||||
for (int recipe : getRecipeIndices()) if (handler.mouseClicked(this, button, recipe)) return;
|
||||
}
|
||||
|
||||
@@ -496,18 +452,13 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
updateAsTooltip();
|
||||
}
|
||||
|
||||
/** updateScreen() that's safe to call when this isn't the currently open GUI */
|
||||
public void updateAsTooltip() {
|
||||
handler.onUpdate();
|
||||
refreshPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
try (HeightHack heightHack = new HeightHack()) {
|
||||
for (int i : getRecipeIndices()) currenttip = handler.handleTooltip(this, currenttip, i);
|
||||
}
|
||||
recipeTabs.handleTooltip(mousex, mousey, currenttip);
|
||||
@@ -517,7 +468,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiContainer gui, ItemStack stack, int mousex, int mousey,
|
||||
List<String> currenttip) {
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
try (HeightHack heightHack = new HeightHack()) {
|
||||
for (int i : getRecipeIndices()) currenttip = handler.handleItemTooltip(this, stack, currenttip, i);
|
||||
}
|
||||
|
||||
@@ -621,13 +572,11 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
PositionedStack result = handler.getResultStack(i);
|
||||
if (result != null) slotcontainer.addSlot(result, p.x, p.y);
|
||||
|
||||
if (!limitToOneRecipe) {
|
||||
List<PositionedStack> catalysts = RecipeCatalysts.getRecipeCatalysts(handler);
|
||||
for (PositionedStack catalyst : catalysts) {
|
||||
int xOffset = -GuiRecipeCatalyst.ingredientSize + 1;
|
||||
int yOffset = BG_TOP_Y + GuiRecipeCatalyst.fullBorder;
|
||||
slotcontainer.addSlot(catalyst, xOffset, yOffset);
|
||||
}
|
||||
List<PositionedStack> catalysts = RecipeCatalysts.getRecipeCatalysts(handler);
|
||||
for (PositionedStack catalyst : catalysts) {
|
||||
int xOffset = -GuiRecipeCatalyst.ingredientSize + 1;
|
||||
int yOffset = BG_TOP_Y + GuiRecipeCatalyst.fullBorder;
|
||||
slotcontainer.addSlot(catalyst, xOffset, yOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -661,25 +610,33 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
GuiContainerManager.enable2DRender();
|
||||
|
||||
fontRendererObj.drawStringWithShadow(
|
||||
String.format("m: %3s,%3s", GuiDraw.getMousePosition().x, GuiDraw.getMousePosition().y),
|
||||
0,
|
||||
-30,
|
||||
0xffffff);
|
||||
fontRendererObj.drawStringWithShadow(String.format("guiTop: %3s", guiTop), 0, -20, 0xffffff);
|
||||
fontRendererObj
|
||||
.drawStringWithShadow(String.format("hHack: %3s", (((guiTop * 2) + 176) - 176) / 2), 0, -10, 0xffffff);
|
||||
|
||||
fontRendererObj.drawStringWithShadow(String.format("guiw/h: %3s,%3s", width, height), 75, -30, 0xffffff);
|
||||
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
final int ySkip = limitToOneRecipe ? 25 : 0;
|
||||
if (!limitToOneRecipe) {
|
||||
String s = handler.getRecipeName().trim();
|
||||
fontRendererObj.drawStringWithShadow(s, (xSize - fontRendererObj.getStringWidth(s)) / 2, 5, 0xffffff);
|
||||
s = NEIClientUtils.translate("recipe.page", page + 1, (handler.numRecipes() - 1) / recipesPerPage + 1);
|
||||
fontRendererObj.drawStringWithShadow(s, (xSize - fontRendererObj.getStringWidth(s)) / 2, 19, 0xffffff);
|
||||
}
|
||||
String s = handler.getRecipeName().trim();
|
||||
fontRendererObj.drawStringWithShadow(s, (xSize - fontRendererObj.getStringWidth(s)) / 2, 5, 0xffffff);
|
||||
s = NEIClientUtils.translate("recipe.page", page + 1, (handler.numRecipes() - 1) / recipesPerPage + 1);
|
||||
fontRendererObj.drawStringWithShadow(s, (xSize - fontRendererObj.getStringWidth(s)) / 2, 19, 0xffffff);
|
||||
final boolean drawItemPresence = NEIClientConfig.isJEIStyleItemPresenceOverlayVisible();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(5, 32 - ySkip + yShift, 0);
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
GL11.glTranslatef(5, 32 + yShift, 0);
|
||||
try (HeightHack heightHack = new HeightHack()) {
|
||||
for (int i = page * recipesPerPage; i < handler.numRecipes() && i < (page + 1) * recipesPerPage; i++) {
|
||||
handler.drawForeground(i);
|
||||
if (drawItemPresence && (isMouseOverOverlayButton(i - page * recipesPerPage) || limitToOneRecipe)
|
||||
&& firstGui != null
|
||||
if (drawItemPresence && isMouseOverOverlayButton(i - page * recipesPerPage)
|
||||
&& firstGui.inventorySlots != null) {
|
||||
List<PositionedStack> ingredients = handler.getIngredientStacks(i);
|
||||
if (itemPresenceCacheRecipe != i || itemPresenceCacheSlots == null
|
||||
@@ -699,27 +656,28 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
final int ySkip = limitToOneRecipe ? 25 : 0;
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
final int j = (width - xSize) / 2;
|
||||
final int k = guiTop;
|
||||
|
||||
drawBackgroundTiled(guiLeft, guiTop);
|
||||
drawBackgroundTiled(j, k);
|
||||
|
||||
if (NEIClientConfig.areJEIStyleTabsVisible() && !limitToOneRecipe) {
|
||||
drawRect(
|
||||
guiLeft + borderPadding + buttonWidth - 1,
|
||||
nexttype.yPosition,
|
||||
guiLeft + xSize - borderPadding - buttonWidth,
|
||||
nexttype.yPosition + buttonHeight,
|
||||
0x30000000);
|
||||
drawRect(
|
||||
guiLeft + borderPadding + buttonWidth - 1,
|
||||
nextpage.yPosition,
|
||||
guiLeft + xSize - borderPadding - buttonWidth,
|
||||
nextpage.yPosition + buttonHeight,
|
||||
0x30000000);
|
||||
drawRect(
|
||||
guiLeft + borderPadding + buttonWidth - 1,
|
||||
nexttype.yPosition,
|
||||
guiLeft + xSize - borderPadding - buttonWidth,
|
||||
nexttype.yPosition + buttonHeight,
|
||||
0x30000000);
|
||||
drawRect(
|
||||
guiLeft + borderPadding + buttonWidth - 1,
|
||||
nextpage.yPosition,
|
||||
guiLeft + xSize - borderPadding - buttonWidth,
|
||||
nextpage.yPosition + buttonHeight,
|
||||
0x30000000);
|
||||
|
||||
if (NEIClientConfig.areJEIStyleTabsVisible()) {
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
recipeTabs.draw(mouseX, mouseY);
|
||||
@@ -730,8 +688,8 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(guiLeft + 5, guiTop - ySkip + 32 + yShift, 0);
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
GL11.glTranslatef(j + 5, k + 32 + yShift, 0);
|
||||
try (HeightHack heightHack = new HeightHack()) {
|
||||
for (int i = page * recipesPerPage; i < handler.numRecipes() && i < (page + 1) * recipesPerPage; i++) {
|
||||
handler.drawBackground(i);
|
||||
GL11.glTranslatef(0, handlerInfo.getHeight(), 0);
|
||||
@@ -742,12 +700,10 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
private void drawBackgroundTiled(int j, int k) {
|
||||
// Draw the top
|
||||
final int ySkip = limitToOneRecipe ? 25 : 0;
|
||||
final int handlerHeight = limitToOneRecipe ? getHeightAsWidget() : ySize;
|
||||
bgTop.draw(j, k + BG_TOP_Y);
|
||||
|
||||
// Maybe Tile the middle
|
||||
final int tiledHeight = handlerHeight - ySkip - BG_TOP_HEIGHT - BG_BOTTOM_HEIGHT;
|
||||
final int tiledHeight = ySize - BG_TOP_HEIGHT - BG_BOTTOM_HEIGHT;
|
||||
|
||||
if (tiledHeight > 0) {
|
||||
final int yTileCount = tiledHeight / BG_MIDDLE_HEIGHT;
|
||||
@@ -764,11 +720,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
// Draw the bottom
|
||||
bgBottom.draw(j, k + handlerHeight - ySkip - BG_BOTTOM_HEIGHT);
|
||||
}
|
||||
|
||||
public int getHeightAsWidget() {
|
||||
return (handlerInfo == null) ? ySize : (handlerInfo.getHeight() + 56);
|
||||
bgBottom.draw(j, k + ySize - BG_BOTTOM_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -804,7 +756,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
private int getRecipesPerPage() {
|
||||
return limitToOneRecipe ? 1 : getRecipesPerPage(handlerInfo);
|
||||
return getRecipesPerPage(handlerInfo);
|
||||
}
|
||||
|
||||
private int getRecipesPerPage(HandlerInfo handlerInfo) {
|
||||
@@ -820,9 +772,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
// reduce the vertical shift here to 16px instead of 32px.
|
||||
return new Point(
|
||||
5,
|
||||
(isHeightHackApplied ? 16 : 32) - (limitToOneRecipe ? 25 : 0)
|
||||
+ yShift
|
||||
+ ((recipe % getRecipesPerPage()) * handlerInfo.getHeight()));
|
||||
(isHeightHackApplied ? 16 : 32) + yShift + ((recipe % getRecipesPerPage()) * handlerInfo.getHeight()));
|
||||
}
|
||||
|
||||
public abstract ArrayList<H> getCurrentRecipeHandlers();
|
||||
|
||||
@@ -165,7 +165,7 @@ public class RecipeCatalysts {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) {
|
||||
CSVParser csvParser = CSVFormat.EXCEL.withFirstRecordAsHeader().parse(reader);
|
||||
for (CSVRecord record : csvParser) {
|
||||
final String handler = record.get("handler");
|
||||
final String handler = record.get("handlerID");
|
||||
final String modId = record.get("modId");
|
||||
final boolean requiresMod = Boolean.parseBoolean(record.get("modRequired"));
|
||||
final String excludedModId = record.get("excludedModId");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# Each line in this file should either be a comment (line starts with '#'), or a fully-qualified class name (that
|
||||
# includes the package name) for a recipe handler. Wildcard patterns ('*') can be used to catch multiple classes with a
|
||||
# single entry.
|
||||
# Each line in this file should either be a comment (starts with '#') or a fully qualified class name (that includes the
|
||||
# package name) for a recipe handler. Wildcard patterns ('*') can be used to catch multiple classes with a single entry.
|
||||
# If you delete this file, it will be regenerated with the default height hacked handlers list.
|
||||
buildcraft.compat.nei.*
|
||||
cofh.thermalexpansion.plugins.nei.handlers.*
|
||||
@@ -11,5 +10,4 @@ mariculture.plugins.nei.*
|
||||
redgear.brewcraft.plugins.nei.*
|
||||
tconstruct.plugins.nei.*
|
||||
WayofTime.alchemicalWizardry.client.nei.*
|
||||
exnihilo.compatibility.nei.*
|
||||
blusunrize.immersiveengineering.client.nei.*
|
||||
exnihilo.compatibility.nei.*
|
||||
@@ -1,6 +1,6 @@
|
||||
# This version of NEI loads recipes in parallel. Some recipe handlers have not been designed with that in mind and might
|
||||
# crash. List these handlers in this file to force them to be loaded single threaded. Each line in this file should
|
||||
# either be a comment (line starts with '#'), or a fully-qualified class name (that includes the package name) for a
|
||||
# recipe handler.
|
||||
# If you delete this file, it will be regenerated with the default serial handlers list.
|
||||
# crash. List these handlers in this file to force them to be loaded a single thread. Each line in this file should
|
||||
# either be a comment (starts with '#') or a fully qualified class name (that includes the package name) for a recipe
|
||||
# handler.
|
||||
# If you delete this file, it will be regenerated with the default height hacked handlers list.
|
||||
WayofTime.alchemicalWizardry.client.nei.NEIAlchemyRecipeHandler
|
||||
@@ -1,4 +1,4 @@
|
||||
handler,itemName,nbtInfo,modId,modRequired,excludedModId,priority,minVersion,maxVersion,forceClassName,itemNotes
|
||||
handlerID,itemName,nbtInfo,modId,modRequired,excludedModId,priority,minVersion,maxVersion,forceClassName,itemNotes
|
||||
crafting,minecraft:crafting_table,,minecraft,FALSE,terrafirmacraftplus,100,,,,
|
||||
smelting,minecraft:furnace,,minecraft,FALSE,terrafirmacraftplus,100,,,,
|
||||
codechicken.nei.recipe.BrewingRecipeHandler,minecraft:brewing_stand,,minecraft,FALSE,terrafirmacraftplus,100,,,,
|
||||
|
||||
|
@@ -373,10 +373,10 @@ NEIArcFurnaceHandlerCarrot Ingot,Immersive Engineering,minecraft:carrot,,Immersi
|
||||
NEIArcFurnaceHandlerExtraction,Immersive Engineering,minecraft:glowstone_dust,,ImmersiveEngineering,TRUE,,,65,166,5,,,,,,
|
||||
blusunrize.immersiveengineering.client.nei.NEIShaderBagHandler,Immersive Engineering,ImmersiveEngineering:shaderBag,,ImmersiveEngineering,TRUE,,,65,166,5,,,,,,
|
||||
blusunrize.immersiveengineering.client.nei.NEIBlueprintHandler,Immersive Engineering,ImmersiveEngineering:woodenDevice:5,,ImmersiveEngineering,TRUE,,,65,166,5,,,,,,
|
||||
blusunrize.immersiveengineering.client.nei.NEICokeOvenHandler,Immersive Engineering,ImmersiveEngineering:stoneDecoration:1,,ImmersiveEngineering,TRUE,,,71,166,2,,,,,,
|
||||
blusunrize.immersiveengineering.client.nei.NEICokeOvenHandler,Immersive Engineering,ImmersiveEngineering:stoneDecoration:1,,ImmersiveEngineering,TRUE,,,71,166,2,,,,,
|
||||
blusunrize.immersiveengineering.client.nei.NEIBlastFurnaceHandler,Immersive Engineering,ImmersiveEngineering:stoneDecoration:2,,ImmersiveEngineering,TRUE,,,71,166,2,,,,,,
|
||||
blusunrize.immersiveengineering.client.nei.NEISqueezerHandler,Immersive Engineering,ImmersiveEngineering:metalMultiblock:2,,ImmersiveEngineering,TRUE,,1,64,166,2,,,,,,
|
||||
blusunrize.immersiveengineering.client.nei.NEIFermenterHandler,Immersive Engineering,ImmersiveEngineering:metalMultiblock:3,,ImmersiveEngineering,TRUE,,1,64,166,2,,,,,,
|
||||
blusunrize.immersiveengineering.client.nei.NEIFermenterHandler,Immersive Engineering,ImmersiveEngineering:metalMultiblock:3,,ImmersiveEngineering,TRUE,,,71,166,2,,,,,,
|
||||
blusunrize.immersiveengineering.client.nei.NEIRefineryHandler,Immersive Engineering,ImmersiveEngineering:metalMultiblock:4,,ImmersiveEngineering,TRUE,,,65,166,2,,,,,,
|
||||
blusunrize.immersiveengineering.client.nei.NEIBottlingMachineHandler,Immersive Engineering,minecraft:glass_bottle,,ImmersiveEngineering,TRUE,,,65,166,5,,,,,,
|
||||
blusunrize.immersiveengineering.client.nei.NEIMetalPressHandler,Immersive Engineering,ImmersiveEngineering:metalMultiblock:13,,ImmersiveEngineering,TRUE,,,65,166,5,,,,,,
|
||||
@@ -437,7 +437,7 @@ mekanism.client.nei.ShapelessMekanismRecipeHandler,Mekanism,minecraft:crafting_t
|
||||
mekanism.client.nei.SolarNeutronRecipeHandler,Mekanism,Mekanism:MachineBlock3:1,,Mekanism,TRUE,,,70,,5,,,,,,
|
||||
mekanism.client.nei.ThermalEvaporationRecipeHandler,Mekanism,Mekanism:BasicBlock:14,,Mekanism,TRUE,,,62,,5,,,,,,
|
||||
exnihilo.compatibility.nei.RecipeHandlerHammer,Ex Nihilo,exnihilo:hammer_iron,,exnihilo,TRUE,,,58,,5,,,,,,
|
||||
exnihilo.compatibility.nei.RecipeHandlerSieve,Ex Nihilo,exnihilo:sifting_table,,exnihilo,TRUE,,,130,,1,,,,,,
|
||||
exnihilo.compatibility.nei.RecipeHandlerSieve,Ex Nihilo,exnihilo:sifting_table,,exnihilo,TRUE,,,130,,2,,,,,,
|
||||
gregtech.Alloy,GregTech-Addon,gregtech_addon:machine:56,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtech.Assembler,GregTech-Addon,gregtech_addon:machine:60,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtech.Bender,GregTech-Addon,gregtech_addon:machine:59,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
|
||||
|
@@ -9,7 +9,6 @@ nei.key.ctrl.mac=CMD
|
||||
nei.bookmark.toggle=Bookmarks
|
||||
nei.bookmark.toggle.tip=Toggle visibility of the Bookmark Panel
|
||||
nei.bookmark.viewmode.toggle.tip=Toggle Bookmark View Mode
|
||||
nei.bookmark.pullBookmarkedItems.tip=Pull all bookmarked items from storage to inventory
|
||||
|
||||
nei.itempanel.quantity.default=One stack
|
||||
nei.itempanel.loading=Loading Item List...
|
||||
@@ -107,7 +106,6 @@ nei.options.keys.gui.search=Focus Search Bar
|
||||
nei.options.keys.gui.bookmark=Add Bookmark
|
||||
nei.options.keys.gui.bookmark_recipe=Add Bookmark with Recipe
|
||||
nei.options.keys.gui.bookmark_count=Add Bookmark with Count
|
||||
nei.options.keys.gui.bookmark_pull_items=Pull all Bookmarked Items
|
||||
nei.options.keys.gui.bookmark_recipe_count=Add Bookmark with Recipe & Count
|
||||
nei.options.keys.gui.hide_bookmarks=Toggle Bookmark Panel Visibility
|
||||
nei.options.keys.gui.overlay=Overlay Recipe
|
||||
@@ -154,9 +152,6 @@ nei.options.inventory.saveCurrentRecipeInBookmarksEnabled.false=Disabled
|
||||
nei.options.inventory.useNBTInBookmarks=Use NBT in Bookmarks
|
||||
nei.options.inventory.useNBTInBookmarks.true=Yes
|
||||
nei.options.inventory.useNBTInBookmarks.false=No
|
||||
nei.options.inventory.recipeTooltipsEnabled=Show recipe tooltips in Bookmarks
|
||||
nei.options.inventory.recipeTooltipsEnabled.true=Yes
|
||||
nei.options.inventory.recipeTooltipsEnabled.false=No
|
||||
nei.options.inventory.bookmarksAnimationEnabled=REI Style Animation in Bookmarks
|
||||
nei.options.inventory.bookmarksAnimationEnabled.true=Yes
|
||||
nei.options.inventory.bookmarksAnimationEnabled.false=No
|
||||
@@ -347,4 +342,4 @@ nei.presets.whitelist.tooltip=Whitelist
|
||||
nei.presets.textfield.tooltip.1=Enter - save
|
||||
nei.presets.textfield.tooltip.2=Escape - cancel
|
||||
nei.presets.label.tooltip=Double click to edit
|
||||
nei.presets.label.selected=%s Presets
|
||||
nei.presets.label.selected=%s Presets
|
||||
Reference in new issue
Block a user