mirror of
https://github.com/GTNewHorizons/FindIt.git
synced 2026-11-24 10:14:21 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84f2cf1182 | ||
|
|
5be63a3f25 | ||
|
|
be83b0edf9 | ||
|
|
4045a075a2 | ||
|
|
f3deeacf6d | ||
|
|
dad262c9cb | ||
|
|
d707559c4b | ||
|
|
d05ce2902c |
No files matched your search
@@ -0,0 +1,27 @@
|
||||
if [[ -d "run/crash-reports" ]]; then
|
||||
echo "Crash reports detected:"
|
||||
cat $directory/*
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet "Fatal errors were detected" server.log; then
|
||||
echo "Fatal errors detected:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log; then
|
||||
echo "Server force stopped:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet 'Done .+ For help, type "help" or "?"' server.log; then
|
||||
echo "Server didn't finish startup:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "No crash reports detected"
|
||||
exit 0
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
name: Build and test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main ]
|
||||
push:
|
||||
branches: [ master, main ]
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
|
||||
secrets: inherit
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
name: Release tagged build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: [ '*' ]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release-tags:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
|
||||
secrets: inherit
|
||||
+25
-20
@@ -1,26 +1,31 @@
|
||||
# eclipse
|
||||
bin
|
||||
*.launch
|
||||
.gradle
|
||||
.settings
|
||||
.metadata
|
||||
/.idea/
|
||||
/run/
|
||||
/build/
|
||||
/eclipse/
|
||||
.classpath
|
||||
.project
|
||||
|
||||
# idea
|
||||
out
|
||||
/bin/
|
||||
/config/
|
||||
/crash-reports/
|
||||
/logs/
|
||||
options.txt
|
||||
/saves/
|
||||
usernamecache.json
|
||||
banned-ips.json
|
||||
banned-players.json
|
||||
eula.txt
|
||||
ops.json
|
||||
server.properties
|
||||
servers.dat
|
||||
usercache.json
|
||||
whitelist.json
|
||||
/out/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
*.iml
|
||||
.idea
|
||||
|
||||
# gradle
|
||||
build
|
||||
.gradle
|
||||
|
||||
# other
|
||||
eclipse
|
||||
run
|
||||
classes
|
||||
/libs/
|
||||
|
||||
src/main/resources/mixins.*.json
|
||||
*.bat
|
||||
*.DS_Store
|
||||
!gradlew.bat
|
||||
@@ -0,0 +1,3 @@
|
||||
# Any Github changes require admin approval
|
||||
/.github/** @GTNewHorizons/admin
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
This is inspired by the "Search in nearby inventories" feature from 1.7.10 Extra Utilities, and from 1.12+ [FindMe](https://github.com/Buuz135/FindMe). Instead of searching inventories, FindIt will search the world for placed tile entities!
|
||||
|
||||
|
||||
Did you forget where you placed your EV Mixer?
|
||||
|
||||
Well no problem now! Locate the item in NEI; however over it and hit 'Y' (the default keybind); if it's within range (+/-16 blocks) it will flash particle effects for you to locate it!
|
||||
+677
-39
@@ -1,84 +1,722 @@
|
||||
//version: 1644349045
|
||||
/*
|
||||
DO NOT CHANGE THIS FILE!
|
||||
|
||||
Also, you may replace this file at any time if there is an update available.
|
||||
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
|
||||
*/
|
||||
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven {
|
||||
name = "forge"
|
||||
url = "http://files.minecraftforge.net/maven"
|
||||
url = "https://maven.minecraftforge.net"
|
||||
}
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
}
|
||||
maven {
|
||||
name = "Scala CI dependencies"
|
||||
url = "https://repo1.maven.org/maven2/"
|
||||
}
|
||||
maven {
|
||||
name = "jitpack"
|
||||
url = "https://jitpack.io"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.github.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT"
|
||||
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'idea'
|
||||
id 'eclipse'
|
||||
id 'scala'
|
||||
id 'maven-publish'
|
||||
id('org.jetbrains.kotlin.jvm') version ('1.6.10') apply false
|
||||
id('org.ajoberstar.grgit') version('4.1.1')
|
||||
id('com.github.johnrengelman.shadow') version('4.0.4')
|
||||
id('com.palantir.git-version') version('0.13.0') apply false
|
||||
id('de.undercouch.download') version('5.0.1')
|
||||
}
|
||||
|
||||
if (project.file('.git/HEAD').isFile()) {
|
||||
apply plugin: 'com.palantir.git-version'
|
||||
}
|
||||
|
||||
apply plugin: 'forge'
|
||||
apply plugin: 'idea'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
def projectJavaVersion = JavaLanguageVersion.of(8)
|
||||
|
||||
version = "${project.minecraftVersion}-${modVersion}"
|
||||
|
||||
group = modGroup
|
||||
archivesBaseName = modBaseName
|
||||
|
||||
minecraft {
|
||||
version = project.forgeVersion
|
||||
runDir = "run"
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(projectJavaVersion)
|
||||
}
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
inheritOutputDirs = true
|
||||
downloadJavadoc = true
|
||||
downloadSources = true
|
||||
}
|
||||
}
|
||||
|
||||
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
|
||||
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
|
||||
}
|
||||
|
||||
checkPropertyExists("modName")
|
||||
checkPropertyExists("modId")
|
||||
checkPropertyExists("modGroup")
|
||||
checkPropertyExists("autoUpdateBuildScript")
|
||||
checkPropertyExists("minecraftVersion")
|
||||
checkPropertyExists("forgeVersion")
|
||||
checkPropertyExists("replaceGradleTokenInFile")
|
||||
checkPropertyExists("gradleTokenModId")
|
||||
checkPropertyExists("gradleTokenModName")
|
||||
checkPropertyExists("gradleTokenVersion")
|
||||
checkPropertyExists("gradleTokenGroupName")
|
||||
checkPropertyExists("apiPackage")
|
||||
checkPropertyExists("accessTransformersFile")
|
||||
checkPropertyExists("usesMixins")
|
||||
checkPropertyExists("mixinPlugin")
|
||||
checkPropertyExists("mixinsPackage")
|
||||
checkPropertyExists("coreModClass")
|
||||
checkPropertyExists("containsMixinsAndOrCoreModOnly")
|
||||
checkPropertyExists("usesShadowedDependencies")
|
||||
checkPropertyExists("developmentEnvironmentUserName")
|
||||
|
||||
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
|
||||
|
||||
String javaSourceDir = "src/main/java/"
|
||||
String scalaSourceDir = "src/main/scala/"
|
||||
String kotlinSourceDir = "src/main/kotlin/"
|
||||
|
||||
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
|
||||
if(apiPackage) {
|
||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
}
|
||||
|
||||
if(accessTransformersFile) {
|
||||
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
|
||||
if(!getFile(targetFile).exists()) {
|
||||
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
|
||||
}
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) {
|
||||
throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!")
|
||||
}
|
||||
|
||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
|
||||
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
|
||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt"
|
||||
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
||||
}
|
||||
}
|
||||
|
||||
if(coreModClass) {
|
||||
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
|
||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt"
|
||||
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
||||
}
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
|
||||
|
||||
// Make sure GregTech build won't time out
|
||||
System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String)
|
||||
System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String)
|
||||
}
|
||||
|
||||
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
|
||||
try {
|
||||
'git config core.fileMode false'.execute()
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.error("\u001B[31mgit isn't installed at all\u001B[0m")
|
||||
}
|
||||
|
||||
// Pulls version first from the VERSION env and then git tag
|
||||
String identifiedVersion
|
||||
String versionOverride = System.getenv("VERSION") ?: null
|
||||
try {
|
||||
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.error("\n\u001B[1;31mThis mod must be version controlled by Git AND the repository must provide at least one tag,\n" +
|
||||
"or the VERSION override must be set! \u001B[32m(Don't download from GitHub using the ZIP option, instead\n" +
|
||||
"clone the repository, see\u001B[33m https://gtnh.miraheze.org/wiki/Development \u001B[32mfor details.)\u001B[0m\n");
|
||||
versionOverride = 'NO-GIT-TAG-SET'
|
||||
identifiedVersion = versionOverride
|
||||
}
|
||||
version = minecraftVersion + '-' + identifiedVersion
|
||||
String modVersion = identifiedVersion
|
||||
|
||||
if( identifiedVersion.equals(versionOverride) ) {
|
||||
logger.error('\u001B[31m\u001B[7mWe hope you know what you\'re doing using\u001B[0m\u001B[1;34m ' + modVersion + '\u001B[0m\n');
|
||||
logger.error('\7\u001B[31mGoing to blindly try to use\u001B[1;34m ' + modVersion + '\u001B[0m\u001B[31m, this probably won\'t work the way you expect!!\u001B[0m\n');
|
||||
}
|
||||
|
||||
group = modGroup
|
||||
if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
||||
archivesBaseName = customArchiveBaseName
|
||||
}
|
||||
else {
|
||||
archivesBaseName = modId
|
||||
}
|
||||
|
||||
|
||||
def arguments = []
|
||||
def jvmArguments = []
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
arguments += [
|
||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
||||
]
|
||||
jvmArguments += [
|
||||
"-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true"
|
||||
]
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
|
||||
runDir = "run"
|
||||
|
||||
if (replaceGradleTokenInFile) {
|
||||
replaceIn replaceGradleTokenInFile
|
||||
if(gradleTokenModId) {
|
||||
replace gradleTokenModId, modId
|
||||
}
|
||||
if(gradleTokenModName) {
|
||||
replace gradleTokenModName, modName
|
||||
}
|
||||
if(gradleTokenVersion) {
|
||||
replace gradleTokenVersion, modVersion
|
||||
}
|
||||
if(gradleTokenGroupName) {
|
||||
replace gradleTokenGroupName, modGroup
|
||||
}
|
||||
}
|
||||
|
||||
clientIntellijRun {
|
||||
args(arguments)
|
||||
jvmArgs(jvmArguments)
|
||||
|
||||
if(developmentEnvironmentUserName) {
|
||||
args("--username", developmentEnvironmentUserName)
|
||||
}
|
||||
}
|
||||
|
||||
serverIntellijRun {
|
||||
args(arguments)
|
||||
jvmArgs(jvmArguments)
|
||||
}
|
||||
}
|
||||
|
||||
if(file("addon.gradle").exists()) {
|
||||
apply from: "addon.gradle"
|
||||
}
|
||||
|
||||
apply from: 'repositories.gradle'
|
||||
|
||||
configurations {
|
||||
provided
|
||||
embedded
|
||||
compile.extendsFrom provided, embedded
|
||||
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
|
||||
implementation.extendsFrom(shadowCompile)
|
||||
implementation.extendsFrom(shadeCompile)
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
flatDir {
|
||||
dirs 'libs'
|
||||
}
|
||||
maven {
|
||||
name = "chickenbones"
|
||||
url = "http://chickenbones.net/maven/"
|
||||
}
|
||||
name = "Overmind forge repo mirror"
|
||||
url = "https://gregtech.overminddl1.com/"
|
||||
}
|
||||
if(usesMixins.toBoolean()) {
|
||||
maven {
|
||||
name = "sponge"
|
||||
url = "https://repo.spongepowered.org/repository/maven-public"
|
||||
}
|
||||
maven {
|
||||
url = "https://jitpack.io"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "codechicken:CodeChickenLib:${project.minecraftVersion}-${project.codechickenlibVersion}:dev"
|
||||
compile "codechicken:CodeChickenCore:${project.minecraftVersion}-${project.codechickencoreVersion}:dev"
|
||||
compile "codechicken:NotEnoughItems:${project.minecraftVersion}-${project.neiVersion}:dev"
|
||||
provided "gregtech:gregtech:${project.gregtechVersion}:dev"
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3")
|
||||
annotationProcessor("com.google.guava:guava:24.1.1-jre")
|
||||
annotationProcessor("com.google.code.gson:gson:2.8.6")
|
||||
annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT")
|
||||
// using 0.8 to workaround a issue in 0.7 which fails mixin application
|
||||
compile("com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH") {
|
||||
// Mixin includes a lot of dependencies that are too up-to-date
|
||||
exclude module: "launchwrapper"
|
||||
exclude module: "guava"
|
||||
exclude module: "gson"
|
||||
exclude module: "commons-io"
|
||||
exclude module: "log4j-core"
|
||||
}
|
||||
compile("com.github.GTNewHorizons:SpongeMixins:1.5.0")
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
apply from: 'dependencies.gradle'
|
||||
|
||||
def mixingConfigRefMap = "mixins." + modId + ".refmap.json"
|
||||
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
|
||||
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
|
||||
|
||||
task generateAssets {
|
||||
if(usesMixins.toBoolean()) {
|
||||
getFile("/src/main/resources/mixins." + modId + ".json").text = """{
|
||||
"required": true,
|
||||
"minVersion": "0.7.11",
|
||||
"package": "${modGroup}.${mixinsPackage}",
|
||||
"plugin": "${modGroup}.${mixinPlugin}",
|
||||
"refmap": "${mixingConfigRefMap}",
|
||||
"target": "@env(DEFAULT)",
|
||||
"compatibilityLevel": "JAVA_8"
|
||||
}
|
||||
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
task relocateShadowJar(type: ConfigureShadowRelocation) {
|
||||
target = tasks.shadowJar
|
||||
prefix = modGroup + ".shadow"
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
project.configurations.shadeCompile.each { dep ->
|
||||
from(project.zipTree(dep)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
}
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
minimize() // This will only allow shading for actually used classes
|
||||
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
|
||||
dependsOn(relocateShadowJar)
|
||||
}
|
||||
|
||||
jar {
|
||||
project.configurations.shadeCompile.each { dep ->
|
||||
from(project.zipTree(dep)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
}
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
if(usesShadowedDependencies.toBoolean()) {
|
||||
dependsOn(shadowJar)
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
reobf {
|
||||
if(usesMixins.toBoolean()) {
|
||||
addExtraSrgFile mixinSrg
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
if(usesMixins.toBoolean()) {
|
||||
tasks.compileJava {
|
||||
options.compilerArgs += [
|
||||
"-AreobfSrgFile=${tasks.reobf.srg}",
|
||||
"-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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
runClient {
|
||||
if(developmentEnvironmentUserName) {
|
||||
arguments += [
|
||||
"--username",
|
||||
developmentEnvironmentUserName
|
||||
]
|
||||
}
|
||||
|
||||
args(arguments)
|
||||
jvmArgs(jvmArguments)
|
||||
}
|
||||
|
||||
runServer {
|
||||
args(arguments)
|
||||
jvmArgs(jvmArguments)
|
||||
}
|
||||
|
||||
tasks.withType(JavaExec).configureEach {
|
||||
javaLauncher.set(
|
||||
javaToolchains.launcherFor {
|
||||
languageVersion = projectJavaVersion
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
processResources
|
||||
{
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
|
||||
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include "mcmod.info"
|
||||
include 'mcmod.info'
|
||||
|
||||
// replace version and mcversion
|
||||
expand "version": project.version, "mcversion": project.minecraft.version
|
||||
// replace modVersion and minecraftVersion
|
||||
expand "minecraftVersion": project.minecraft.version,
|
||||
"modVersion": modVersion,
|
||||
"modId": modId,
|
||||
"modName": modName
|
||||
}
|
||||
|
||||
// copy everything else, that's not the mcmod.info
|
||||
if(usesMixins.toBoolean()) {
|
||||
from refMap
|
||||
}
|
||||
|
||||
// copy everything else that's not the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude "mcmod.info"
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
}
|
||||
|
||||
def getManifestAttributes() {
|
||||
def manifestAttributes = [:]
|
||||
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
|
||||
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
||||
}
|
||||
|
||||
if(accessTransformersFile) {
|
||||
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
|
||||
}
|
||||
|
||||
if(coreModClass) {
|
||||
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
manifestAttributes += [
|
||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
||||
"MixinConfigs" : "mixins." + modId + ".json",
|
||||
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
|
||||
]
|
||||
}
|
||||
return manifestAttributes
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from (sourceSets.main.allJava)
|
||||
from (file("$projectDir/LICENSE"))
|
||||
getArchiveClassifier().set('sources')
|
||||
}
|
||||
|
||||
task shadowDevJar(type: ShadowJar) {
|
||||
project.configurations.shadeCompile.each { dep ->
|
||||
from(project.zipTree(dep)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
}
|
||||
}
|
||||
|
||||
from sourceSets.main.output
|
||||
getArchiveClassifier().set("dev")
|
||||
|
||||
manifest {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
minimize() // This will only allow shading for actually used classes
|
||||
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
|
||||
}
|
||||
|
||||
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
|
||||
target = tasks.shadowDevJar
|
||||
prefix = modGroup + ".shadow"
|
||||
}
|
||||
|
||||
task circularResolverJar(type: Jar) {
|
||||
dependsOn(relocateShadowDevJar)
|
||||
dependsOn(shadowDevJar)
|
||||
enabled = false
|
||||
}
|
||||
|
||||
task devJar(type: Jar) {
|
||||
project.configurations.shadeCompile.each { dep ->
|
||||
from(project.zipTree(dep)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
}
|
||||
}
|
||||
|
||||
from sourceSets.main.output
|
||||
getArchiveClassifier().set("dev")
|
||||
|
||||
manifest {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
if(usesShadowedDependencies.toBoolean()) {
|
||||
dependsOn(circularResolverJar)
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
task apiJar(type: Jar) {
|
||||
from (sourceSets.main.allJava) {
|
||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
||||
}
|
||||
|
||||
from (sourceSets.main.output) {
|
||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
||||
}
|
||||
|
||||
from (sourceSets.main.resources.srcDirs) {
|
||||
include("LICENSE")
|
||||
}
|
||||
|
||||
getArchiveClassifier().set('api')
|
||||
}
|
||||
|
||||
artifacts {
|
||||
if(!noPublishedSources) {
|
||||
archives sourcesJar
|
||||
}
|
||||
archives devJar
|
||||
if(apiPackage) {
|
||||
archives apiJar
|
||||
}
|
||||
}
|
||||
|
||||
// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID),
|
||||
// and isn't strictly needed with the POM so just disable it.
|
||||
tasks.withType(GenerateModuleMetadata) {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from components.java
|
||||
if(usesShadowedDependencies.toBoolean()) {
|
||||
artifact source: shadowJar, classifier: ""
|
||||
}
|
||||
if(!noPublishedSources) {
|
||||
artifact source: sourcesJar, classifier: "src"
|
||||
}
|
||||
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
|
||||
if (apiPackage) {
|
||||
artifact source: apiJar, classifier: "api"
|
||||
}
|
||||
|
||||
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons"
|
||||
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
|
||||
// Using the identified version, not project.version as it has the prepended 1.7.10
|
||||
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
|
||||
|
||||
// remove extra garbage from who knows where
|
||||
pom.withXml {
|
||||
def badPomGroup = ['net.minecraft', 'com.google.code.findbugs', 'org.ow2.asm', 'com.typesafe.akka', 'com.typesafe', 'org.scala-lang',
|
||||
'org.scala-lang.plugins', 'net.sf.jopt-simple', 'lzma', 'com.mojang', 'org.apache.commons', 'org.apache.httpcomponents',
|
||||
'commons-logging', 'java3d', 'net.sf.trove4j', 'com.ibm.icu', 'com.paulscode', 'io.netty', 'com.google.guava',
|
||||
'commons-io', 'commons-codec', 'net.java.jinput', 'net.java.jutils', 'com.google.code.gson', 'org.apache.logging.log4j',
|
||||
'org.lwjgl.lwjgl', 'tv.twitch', '']
|
||||
Node pomNode = asNode()
|
||||
pomNode.dependencies.'*'.findAll() {
|
||||
badPomGroup.contains(it.groupId.text())
|
||||
}.each() {
|
||||
it.parent().remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
|
||||
credentials {
|
||||
username = System.getenv("MAVEN_USER") ?: "NONE"
|
||||
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Updating
|
||||
task updateBuildScript {
|
||||
doLast {
|
||||
if (performBuildScriptUpdate(projectDir.toString())) return
|
||||
|
||||
print("Build script already up-to-date!")
|
||||
}
|
||||
}
|
||||
|
||||
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
|
||||
if (autoUpdateBuildScript.toBoolean()) {
|
||||
performBuildScriptUpdate(projectDir.toString())
|
||||
} else {
|
||||
println("Build script update available! Run 'gradle updateBuildScript'")
|
||||
}
|
||||
}
|
||||
|
||||
static URL availableBuildScriptUrl() {
|
||||
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
|
||||
}
|
||||
|
||||
boolean performBuildScriptUpdate(String projectDir) {
|
||||
if (isNewBuildScriptVersionAvailable(projectDir)) {
|
||||
def buildscriptFile = getFile("build.gradle")
|
||||
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
||||
print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
boolean isNewBuildScriptVersionAvailable(String projectDir) {
|
||||
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
|
||||
|
||||
String currentBuildScript = getFile("build.gradle").getText()
|
||||
String currentBuildScriptHash = getVersionHash(currentBuildScript)
|
||||
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
|
||||
String availableBuildScriptHash = getVersionHash(availableBuildScript)
|
||||
|
||||
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
|
||||
return !isUpToDate
|
||||
}
|
||||
|
||||
static String getVersionHash(String buildScriptContent) {
|
||||
String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
|
||||
if(versionLine != null) {
|
||||
return versionLine.split(": ").last()
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
configure(updateBuildScript) {
|
||||
group = 'forgegradle'
|
||||
description = 'Updates the build script to the latest version'
|
||||
}
|
||||
|
||||
// Deobfuscation
|
||||
|
||||
def deobf(String sourceURL) {
|
||||
try {
|
||||
URL url = new URL(sourceURL)
|
||||
String fileName = url.getFile()
|
||||
|
||||
//get rid of directories:
|
||||
int lastSlash = fileName.lastIndexOf("/")
|
||||
if(lastSlash > 0) {
|
||||
fileName = fileName.substring(lastSlash + 1)
|
||||
}
|
||||
//get rid of extension:
|
||||
if(fileName.endsWith(".jar")) {
|
||||
fileName = fileName.substring(0, fileName.lastIndexOf("."))
|
||||
}
|
||||
|
||||
String hostName = url.getHost()
|
||||
if(hostName.startsWith("www.")) {
|
||||
hostName = hostName.substring(4)
|
||||
}
|
||||
List parts = Arrays.asList(hostName.split("\\."))
|
||||
Collections.reverse(parts)
|
||||
hostName = String.join(".", parts)
|
||||
|
||||
return deobf(sourceURL, hostName + "/" + fileName)
|
||||
} catch(Exception e) {
|
||||
return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode()))
|
||||
}
|
||||
}
|
||||
|
||||
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
|
||||
def deobf(String sourceURL, String fileName) {
|
||||
String cacheDir = System.getProperty("user.home") + "/.gradle/caches/"
|
||||
String bon2Dir = cacheDir + "forge_gradle/deobf"
|
||||
String bon2File = bon2Dir + "/BON2-2.5.0.jar"
|
||||
String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar"
|
||||
String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar"
|
||||
|
||||
if(file(deobfFile).exists()) {
|
||||
return files(deobfFile)
|
||||
}
|
||||
|
||||
download.run {
|
||||
src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar'
|
||||
dest bon2File
|
||||
quiet true
|
||||
overwrite false
|
||||
}
|
||||
|
||||
download.run {
|
||||
src sourceURL
|
||||
dest obfFile
|
||||
quiet true
|
||||
overwrite false
|
||||
}
|
||||
|
||||
exec {
|
||||
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch'
|
||||
workingDir bon2Dir
|
||||
standardOutput = new ByteArrayOutputStream()
|
||||
}
|
||||
|
||||
return files(deobfFile)
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
|
||||
def checkPropertyExists(String propertyName) {
|
||||
if (project.hasProperty(propertyName) == false) {
|
||||
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties")
|
||||
}
|
||||
}
|
||||
|
||||
def getFile(String relativePath) {
|
||||
return new File(projectDir, relativePath)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.27-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.33:dev')
|
||||
}
|
||||
+67
-9
@@ -1,9 +1,67 @@
|
||||
modGroup=com.gtnh
|
||||
modVersion=1.0.2
|
||||
modBaseName=findit
|
||||
forgeVersion=1.7.10-10.13.4.1614-1.7.10
|
||||
minecraftVersion=1.7.10
|
||||
codechickenlibVersion=1.1.3.140
|
||||
codechickencoreVersion=1.0.7.47
|
||||
neiVersion=1.0.3.57
|
||||
gregtechVersion=5.09.37.07
|
||||
modName = FindIt
|
||||
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
modId = findit
|
||||
|
||||
modGroup = com.gtnh
|
||||
|
||||
# WHY is there no version field?
|
||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
||||
|
||||
# Will update your build.gradle automatically whenever an update is available
|
||||
autoUpdateBuildScript = false
|
||||
|
||||
minecraftVersion = 1.7.10
|
||||
forgeVersion = 10.13.4.1614
|
||||
|
||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
||||
# restart Minecraft in development. Choose this dependent on your mod:
|
||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Define a source file of your project with:
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...])
|
||||
# Leave these properties empty to skip individual token replacements
|
||||
replaceGradleTokenInFile = FindIt.java
|
||||
gradleTokenModId = GRADLETOKEN_MODID
|
||||
gradleTokenModName = GRADLETOKEN_MODNAME
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
gradleTokenGroupName =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||
# leave this property empty.
|
||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||
apiPackage =
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||
# Example value: mymodid_at.cfg
|
||||
accessTransformersFile = findit_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
mixinsPackage =
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass =
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
containsMixinsAndOrCoreModOnly = false
|
||||
|
||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
|
||||
# responsibility check the licence and request permission for distribution, if required.
|
||||
usesShadowedDependencies = false
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
||||
# projects. New projects should not use this parameter.
|
||||
#customArchiveBaseName =
|
||||
|
||||
# Optional parameter to prevent the source code from being published
|
||||
# noPublishedSources =
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
|
||||
@@ -1,5 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
@@ -109,8 +125,8 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
Vendored
+17
-7
@@ -1,3 +1,19 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
@@ -49,7 +65,6 @@ goto fail
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
@@ -60,11 +75,6 @@ set _SKIP=2
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
before_install:
|
||||
- ./gradlew setupCIWorkspace
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "GTNH Maven"
|
||||
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
}
|
||||
maven {
|
||||
name = "ic2"
|
||||
url = "https://maven.ic2.player.to/"
|
||||
metadataSources {
|
||||
mavenPom()
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url "https://cursemaven.com"
|
||||
}
|
||||
maven {
|
||||
url = "https://jitpack.io"
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.gtnh.findit;
|
||||
|
||||
import com.gtnh.findit.proxy.FindItCommon;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import com.gtnh.findit.service.blockfinder.BlockFindService;
|
||||
import com.gtnh.findit.service.blockfinder.ClientBlockFindService;
|
||||
import com.gtnh.findit.service.cooldown.SearchCooldownService;
|
||||
import com.gtnh.findit.service.itemfinder.ClientItemFindService;
|
||||
import com.gtnh.findit.service.itemfinder.ItemFindService;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import java.io.File;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@Mod(
|
||||
modid = FindIt.MOD_ID,
|
||||
@@ -23,57 +22,52 @@ import java.io.File;
|
||||
public class FindIt {
|
||||
|
||||
// Mod info
|
||||
public static final String MOD_ID = "findit";
|
||||
public static final String MOD_NAME = "FindIt";
|
||||
public static final String VERSION = "1.0.1";
|
||||
|
||||
// Config
|
||||
public static int SEARCH_RADIUS = 16;
|
||||
|
||||
public static final SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);
|
||||
public static final String MOD_ID = "GRADLETOKEN_MODID";
|
||||
public static final String MOD_NAME = "GRADLETOKEN_MODNAME";
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
|
||||
@Mod.Instance(MOD_ID)
|
||||
public static FindIt INSTANCE;
|
||||
|
||||
@SidedProxy(serverSide = "com.gtnh.findit.proxy.FindItCommon", clientSide = "com.gtnh.findit.proxy.FindItClient")
|
||||
public static FindItCommon proxy;
|
||||
private boolean extraUtilitiesLoaded;
|
||||
|
||||
private SearchCooldownService cooldownService;
|
||||
private BlockFindService blockFindService;
|
||||
private ItemFindService itemFindService;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preinit(FMLPreInitializationEvent event) {
|
||||
this.setupConfig(event.getSuggestedConfigurationFile());
|
||||
proxy.preinit(event);
|
||||
}
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
extraUtilitiesLoaded = Loader.isModLoaded("ExtraUtilities");
|
||||
FindItConfig.setup(event.getSuggestedConfigurationFile());
|
||||
boolean isClient = event.getSide() == Side.CLIENT;
|
||||
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
cooldownService = new SearchCooldownService();
|
||||
blockFindService = isClient ? new ClientBlockFindService() : new BlockFindService();
|
||||
itemFindService = isClient ? new ClientItemFindService() : new ItemFindService();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postinit(FMLPostInitializationEvent event) {
|
||||
proxy.postinit(event);
|
||||
}
|
||||
|
||||
public void setupConfig(final File file) {
|
||||
final Configuration config = new Configuration(file);
|
||||
try {
|
||||
// Load config
|
||||
config.load();
|
||||
|
||||
// Read props from config
|
||||
Property searchRadiousProp = config.get(Configuration.CATEGORY_GENERAL,
|
||||
"SearchRadius", // Property name
|
||||
"16", // Default value
|
||||
"Radius to search within"); // Comment
|
||||
|
||||
FindIt.SEARCH_RADIUS = searchRadiousProp.getInt();
|
||||
} catch (Exception e) {
|
||||
// Failed reading/writing, just continue
|
||||
} finally {
|
||||
// Save props to config IF config changed
|
||||
if (config.hasChanged()) config.save();
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
if (event.getSide() == Side.CLIENT && FindIt.isExtraUtilitiesLoaded()) {
|
||||
GuiContainerManager.inputHandlers.removeIf((inputHandler) ->
|
||||
inputHandler.getClass().getName().equals("com.rwtema.extrautils.nei.ping.NEIPing")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static SearchCooldownService getCooldownService() {
|
||||
return INSTANCE.cooldownService;
|
||||
}
|
||||
|
||||
public static BlockFindService getBlockFindService() {
|
||||
return INSTANCE.blockFindService;
|
||||
}
|
||||
|
||||
public static ItemFindService getItemFindService() {
|
||||
return INSTANCE.itemFindService;
|
||||
}
|
||||
|
||||
public static boolean isExtraUtilitiesLoaded() {
|
||||
return INSTANCE.extraUtilitiesLoaded;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.gtnh.findit;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class FindItConfig {
|
||||
|
||||
public static int SEARCH_RADIUS = 16;
|
||||
public static int SEARCH_COOLDOWN = 10;
|
||||
public static int MAX_RESPONSE_SIZE = 20;
|
||||
|
||||
public static void setup(final File file) {
|
||||
final Configuration config = new Configuration(file);
|
||||
try {
|
||||
config.load();
|
||||
|
||||
SEARCH_RADIUS = config.get(
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
"SearchRadius",
|
||||
"16",
|
||||
"Radius to search within"
|
||||
).getInt();
|
||||
|
||||
SEARCH_COOLDOWN = config.get(
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
"SearchCooldown",
|
||||
"10",
|
||||
"Search cooldown in ticks"
|
||||
).getInt();
|
||||
|
||||
MAX_RESPONSE_SIZE = config.get(
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
"MaxResponseSize",
|
||||
"20",
|
||||
"Maximum number of positions that can be displayed by item/block search"
|
||||
).getInt();
|
||||
} catch (Exception ignore) {
|
||||
} finally {
|
||||
if (config.hasChanged()) config.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.gtnh.findit;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class FindItNetwork {
|
||||
|
||||
private static int lastMessageId = -1;
|
||||
public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(FindIt.MOD_ID);
|
||||
|
||||
public static <REQ extends IMessage, REPLY extends IMessage> void registerMessage(Class<? extends IMessageHandler<REQ, REPLY>> messageHandler, Class<REQ> requestMessageType, Side side) {
|
||||
CHANNEL.registerMessage(messageHandler, requestMessageType, ++lastMessageId, side);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.gtnh.findit.fx;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityReddustFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ParticlePosition extends EntityReddustFX {
|
||||
|
||||
private static int validVersion = 0;
|
||||
|
||||
private int version;
|
||||
|
||||
public ParticlePosition(World world, ChunkPosition pos) {
|
||||
this(
|
||||
world,
|
||||
pos.chunkPosX + (0.5 + (world.rand.nextDouble() - 0.5) * world.rand.nextDouble()),
|
||||
pos.chunkPosY + (0.5 + (world.rand.nextDouble() - 0.5) * world.rand.nextDouble()),
|
||||
pos.chunkPosZ + (0.5 + (world.rand.nextDouble() - 0.5) * world.rand.nextDouble())
|
||||
);
|
||||
version = validVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if (version == validVersion) {
|
||||
super.onUpdate();
|
||||
} else {
|
||||
setDead();
|
||||
}
|
||||
}
|
||||
|
||||
public ParticlePosition(World world, double posX, double posY, double posZ) {
|
||||
super(world, posX, posY, posZ, 255 / 255f, 165 / 255f, 255 / 255f);
|
||||
this.noClip = true;
|
||||
this.particleMaxAge *= 10;
|
||||
this.motionX *= 0.1;
|
||||
this.motionY *= 0.1;
|
||||
this.motionZ *= 0.1;
|
||||
this.particleScale *= 2.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(final Tessellator tessellator, float partialTickTime, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
super.renderParticle(tessellator, partialTickTime, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
tessellator.startDrawingQuads();
|
||||
}
|
||||
|
||||
public static void highlightBlocks(World world, List<ChunkPosition> positions) {
|
||||
validVersion++;
|
||||
int particleCount = positions.size() <= 10 ? 12 : Math.max(12 - (positions.size() - 10) / 2, 2);
|
||||
for (ChunkPosition pos : positions) {
|
||||
for (int i = 0; i < particleCount; ++i) {
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticlePosition(world, pos));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.gtnh.findit.fx;
|
||||
|
||||
import com.gtnh.findit.FindIt;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SlotHighlighter {
|
||||
|
||||
private static final ResourceLocation highlightTexture = new ResourceLocation(FindIt.MOD_ID, "textures/gui/slot_highlight.png");
|
||||
|
||||
public static void highlightSlots(GuiContainer gui, List<Integer> slots, int color) {
|
||||
if (slots.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
float red = (float) (color >> 16 & 255) / 255.0F;
|
||||
float green = (float) (color >> 8 & 255) / 255.0F;
|
||||
float blue = (float) (color & 255) / 255.0F;
|
||||
float alpha = (float) (color >> 24 & 255) / 255.0F;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(gui.guiLeft, gui.guiTop, 0);
|
||||
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(highlightTexture);
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(red, green, blue, alpha);
|
||||
|
||||
for (int slotId : slots) {
|
||||
Slot slot = gui.inventorySlots.getSlot(slotId);
|
||||
highlightSlot(tessellator, slot.xDisplayPosition - 1, slot.yDisplayPosition - 1);
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private static void highlightSlot(Tessellator tessellator, int x, int y) {
|
||||
double zLevel = 1;
|
||||
int x2 = x + 18;
|
||||
int y2 = y + 18;
|
||||
|
||||
tessellator.addVertexWithUV(x2, y, zLevel, 18 / 32.0, 0);
|
||||
tessellator.addVertexWithUV(x, y, zLevel, 0, 0);
|
||||
tessellator.addVertexWithUV(x, y2, zLevel, 0, 18 / 32.0);
|
||||
tessellator.addVertexWithUV(x2, y2, zLevel, 18 / 32.0, 18 / 32.0);
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package com.gtnh.findit.network;
|
||||
|
||||
import com.gtnh.findit.proxy.client.ParticlePosition;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class KIFoundItMessage implements IMessage {
|
||||
|
||||
private List<ChunkPosition> positions;
|
||||
|
||||
public KIFoundItMessage(List<ChunkPosition> positions) {
|
||||
this.positions = positions;
|
||||
}
|
||||
|
||||
public KIFoundItMessage() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
PacketBuffer packetBuffer = new PacketBuffer(buf);
|
||||
int amount = packetBuffer.readInt();
|
||||
positions = new ArrayList<>();
|
||||
while (amount > 0) {
|
||||
final int x = packetBuffer.readInt();
|
||||
final int y = packetBuffer.readUnsignedByte();
|
||||
final int z = packetBuffer.readInt();
|
||||
positions.add(new ChunkPosition(x, y, z));
|
||||
--amount;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
PacketBuffer packetBuffer = new PacketBuffer(buf);
|
||||
packetBuffer.writeInt(positions.size());
|
||||
for (ChunkPosition pos : positions) {
|
||||
packetBuffer.writeInt(pos.chunkPosX);
|
||||
packetBuffer.writeByte(pos.chunkPosY);
|
||||
packetBuffer.writeInt(pos.chunkPosZ);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<KIFoundItMessage, IMessage> {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IMessage onMessage(KIFoundItMessage message, MessageContext ctx) {
|
||||
Minecraft.getMinecraft().thePlayer.closeScreen();
|
||||
World world = Minecraft.getMinecraft().thePlayer.worldObj;
|
||||
for (ChunkPosition pos : message.positions) {
|
||||
for (int i = 0; i < 2; ++i)
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(
|
||||
new ParticlePosition(
|
||||
Minecraft.getMinecraft().thePlayer.worldObj,
|
||||
pos.chunkPosX + (0.5 + (world.rand.nextDouble() - 0.5) * world.rand.nextDouble()),
|
||||
pos.chunkPosY + (0.5 + (world.rand.nextDouble() - 0.5) * world.rand.nextDouble()),
|
||||
pos.chunkPosZ + (0.5 + (world.rand.nextDouble() - 0.5) * world.rand.nextDouble())
|
||||
)
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
package com.gtnh.findit.network;
|
||||
|
||||
import com.gtnh.findit.FindIt;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
public class PlzFindItMessage implements IMessage {
|
||||
static WeakHashMap<EntityPlayerMP, Long> lastCalled = new WeakHashMap<>();
|
||||
|
||||
private ItemStack stack;
|
||||
|
||||
public PlzFindItMessage(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public PlzFindItMessage() {
|
||||
}
|
||||
|
||||
public static List<ChunkPosition> getBlockPosInAABB(AxisAlignedBB axisAlignedBB) {
|
||||
List<ChunkPosition> blocks = new ArrayList<>();
|
||||
|
||||
int maxY = (int) Math.round(axisAlignedBB.maxY),
|
||||
maxX = (int) Math.round(axisAlignedBB.maxX),
|
||||
maxZ = (int) Math.round(axisAlignedBB.maxZ);
|
||||
|
||||
for (int y = (int) Math.round(axisAlignedBB.minY); y < maxY; ++y) {
|
||||
for (int x = (int) Math.round(axisAlignedBB.minX); x < maxX; ++x) {
|
||||
for (int z = (int) Math.round(axisAlignedBB.minZ); z < maxZ; ++z) {
|
||||
blocks.add(new ChunkPosition(x, y, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
PacketBuffer packetBuffer = new PacketBuffer(buf);
|
||||
stack = null;
|
||||
try {
|
||||
stack = packetBuffer.readItemStackFromBuffer();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
PacketBuffer packetBuffer = new PacketBuffer(buf);
|
||||
try {
|
||||
packetBuffer.writeItemStackToBuffer(stack);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<PlzFindItMessage, KIFoundItMessage> {
|
||||
|
||||
@Override
|
||||
public KIFoundItMessage onMessage(PlzFindItMessage message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
World world = player.worldObj;
|
||||
|
||||
// Don't let people spam this, otherwise bad performance and they'll probably get disconnected
|
||||
final long time = world.getTotalWorldTime();
|
||||
final Long lastCalled = PlzFindItMessage.lastCalled.get(player);
|
||||
if (lastCalled != null && time - lastCalled < 10L) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final Item toFind = message.stack.getItem();
|
||||
final int metaToFind = message.stack.getItemDamage();
|
||||
|
||||
final double x = player.posX,
|
||||
y = player.posY,
|
||||
z = player.posZ;
|
||||
|
||||
int r = FindIt.SEARCH_RADIUS;
|
||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x - r, y - r, z -r, x + r, y + r, z + r);
|
||||
|
||||
List<ChunkPosition> posList = new ArrayList<>();
|
||||
for (ChunkPosition pos : getBlockPosInAABB(box)) {
|
||||
try {
|
||||
final TileEntity tileEntity = world.getTileEntity(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ);
|
||||
if(tileEntity == null) continue;
|
||||
|
||||
final Item tileItem = Item.getItemFromBlock(tileEntity.getBlockType());
|
||||
if (tileItem == null) continue;
|
||||
|
||||
final int tileMeta;
|
||||
if (tileEntity instanceof IGregTechTileEntity)
|
||||
tileMeta = ((IGregTechTileEntity)tileEntity).getMetaTileID();
|
||||
else
|
||||
tileMeta = world.getBlockMetadata(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ);
|
||||
|
||||
if (toFind.equals(tileItem) && metaToFind == tileMeta) {
|
||||
posList.add(pos);
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (!posList.isEmpty())
|
||||
FindIt.NETWORK.sendTo(new KIFoundItMessage(posList), player);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.gtnh.findit.proxy;
|
||||
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerInputHandler;
|
||||
import com.gtnh.findit.FindIt;
|
||||
import com.gtnh.findit.network.PlzFindItMessage;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
|
||||
public class FindItClient extends FindItCommon implements IContainerInputHandler{
|
||||
|
||||
@Override
|
||||
public void preinit(FMLPreInitializationEvent event) {
|
||||
super.preinit(event);
|
||||
API.addKeyBind("gui.findit", Keyboard.KEY_Y);
|
||||
GuiContainerManager.addInputHandler((IContainerInputHandler)new FindItClient());
|
||||
}
|
||||
|
||||
public boolean keyTyped(final GuiContainer window, final char c, final int k) {
|
||||
final int keyBinding = NEIClientConfig.getKeyBinding("gui.findit");
|
||||
if (k != keyBinding) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final LayoutManager layout = LayoutManager.instance();
|
||||
if (layout == null || LayoutManager.itemPanel == null || NEIClientConfig.isHidden()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final ItemStack stack = GuiContainerManager.getStackMouseOver(window);
|
||||
if (stack == null || stack.getItem() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FindIt.NETWORK.sendToServer(new PlzFindItMessage(stack));
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onKeyTyped(final GuiContainer guiContainer, final char c, final int i) {
|
||||
}
|
||||
|
||||
public boolean lastKeyTyped(final GuiContainer guiContainer, final char c, final int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean mouseClicked(final GuiContainer guiContainer, final int i, final int i1, final int i2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onMouseClicked(final GuiContainer guiContainer, final int i, final int i1, final int i2) {
|
||||
}
|
||||
|
||||
public void onMouseUp(final GuiContainer guiContainer, final int i, final int i1, final int i2) {
|
||||
}
|
||||
|
||||
public boolean mouseScrolled(final GuiContainer guiContainer, final int i, final int i1, final int i2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onMouseScrolled(final GuiContainer guiContainer, final int i, final int i1, final int i2) {
|
||||
}
|
||||
|
||||
public void onMouseDragged(final GuiContainer guiContainer, final int i, final int i1, final int i2, final long l) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.gtnh.findit.proxy;
|
||||
|
||||
import com.gtnh.findit.network.KIFoundItMessage;
|
||||
import com.gtnh.findit.network.PlzFindItMessage;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
import static com.gtnh.findit.FindIt.NETWORK;
|
||||
|
||||
public class FindItCommon {
|
||||
|
||||
|
||||
public void preinit(FMLPreInitializationEvent event) {
|
||||
NETWORK.registerMessage(PlzFindItMessage.Handler.class, PlzFindItMessage.class, 0, Side.SERVER);
|
||||
NETWORK.registerMessage(KIFoundItMessage.Handler.class, KIFoundItMessage.class, 1, Side.CLIENT);
|
||||
}
|
||||
|
||||
|
||||
public void init(FMLInitializationEvent event) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void postinit(FMLPostInitializationEvent event) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.gtnh.findit.proxy.client;
|
||||
|
||||
import net.minecraft.client.particle.EntityReddustFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ParticlePosition extends EntityReddustFX {
|
||||
|
||||
public ParticlePosition(World world, double posX, double posY, double posZ) {
|
||||
super(world, posX, posY, posZ, 1.0f, 1.0f, 1.0f);
|
||||
this.noClip = true;
|
||||
this.particleMaxAge *= 10;
|
||||
this.motionX *= 0.1;
|
||||
this.motionY *= 0.1;
|
||||
this.motionZ *= 0.1;
|
||||
this.particleScale *= 2.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(final Tessellator tessellator, float partialTickTime, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
super.renderParticle(tessellator, partialTickTime, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
super.renderParticle(tessellator, partialTickTime, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.gtnh.findit.service.blockfinder;
|
||||
|
||||
import com.gtnh.findit.FindIt;
|
||||
import com.gtnh.findit.FindItConfig;
|
||||
import com.gtnh.findit.FindItNetwork;
|
||||
import com.gtnh.findit.util.WorldUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockFindService {
|
||||
|
||||
public BlockFindService() {
|
||||
FindItNetwork.registerMessage(FindBlockRequest.Handler.class, FindBlockRequest.class, Side.SERVER);
|
||||
FindItNetwork.registerMessage(BlockFoundResponse.Handler.class, BlockFoundResponse.class, Side.CLIENT);
|
||||
}
|
||||
public void handleRequest(EntityPlayerMP player, FindBlockRequest request) {
|
||||
if (FindIt.getCooldownService().checkSearchCooldown(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ChunkPosition> positions = new ArrayList<>();
|
||||
for (TileEntity tileEntity : WorldUtils.getTileEntitiesAround(player, FindItConfig.SEARCH_RADIUS)) {
|
||||
try {
|
||||
Block tileBlock = tileEntity.getBlockType();
|
||||
if (!request.getBlockToFind().equals(tileBlock)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int tileMeta;
|
||||
if (tileEntity instanceof IGregTechTileEntity) {
|
||||
tileMeta = ((IGregTechTileEntity) tileEntity).getMetaTileID();
|
||||
} else {
|
||||
tileMeta = tileEntity.getBlockMetadata();
|
||||
}
|
||||
|
||||
if (request.getMetaToFind() == tileMeta) {
|
||||
positions.add(new ChunkPosition(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
|
||||
if (positions.size() == FindItConfig.MAX_RESPONSE_SIZE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (!positions.isEmpty()) {
|
||||
FindItNetwork.CHANNEL.sendTo(new BlockFoundResponse(positions), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.gtnh.findit.service.blockfinder;
|
||||
|
||||
import com.gtnh.findit.util.ProtoUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockFoundResponse implements IMessage {
|
||||
|
||||
private List<ChunkPosition> positions;
|
||||
|
||||
public BlockFoundResponse(List<ChunkPosition> positions) {
|
||||
this.positions = positions;
|
||||
}
|
||||
|
||||
public BlockFoundResponse() {
|
||||
}
|
||||
|
||||
public List<ChunkPosition> getPositions() {
|
||||
return positions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
positions = ProtoUtils.readPositions(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
ProtoUtils.writePositions(buf, positions);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<BlockFoundResponse, IMessage> {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IMessage onMessage(BlockFoundResponse message, MessageContext ctx) {
|
||||
ClientBlockFindService.getInstance().handleResponse(Minecraft.getMinecraft().thePlayer, message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.gtnh.findit.service.blockfinder;
|
||||
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import com.gtnh.findit.FindIt;
|
||||
import com.gtnh.findit.FindItNetwork;
|
||||
import com.gtnh.findit.fx.ParticlePosition;
|
||||
import com.gtnh.findit.util.AbstractStackFinder;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class ClientBlockFindService extends BlockFindService {
|
||||
|
||||
public ClientBlockFindService() {
|
||||
API.addHashBind("gui.findit.find_block", Keyboard.KEY_Y + NEIClientUtils.SHIFT_HASH);
|
||||
GuiContainerManager.addInputHandler(new BlockFindInputHandler());
|
||||
}
|
||||
|
||||
public void handleResponse(EntityClientPlayerMP player, BlockFoundResponse response) {
|
||||
player.closeScreen();
|
||||
ParticlePosition.highlightBlocks(player.worldObj, response.getPositions());
|
||||
}
|
||||
|
||||
private static class BlockFindInputHandler extends AbstractStackFinder {
|
||||
|
||||
@Override
|
||||
protected String getKeyBindId() {
|
||||
return "gui.findit.find_block";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean findStack(ItemStack stack) {
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
if (block == Blocks.air) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FindItNetwork.CHANNEL.sendToServer(new FindBlockRequest(block, stack.getItemDamage()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static ClientBlockFindService getInstance() {
|
||||
return (ClientBlockFindService) FindIt.getBlockFindService();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.gtnh.findit.service.blockfinder;
|
||||
|
||||
import com.gtnh.findit.FindIt;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
public class FindBlockRequest implements IMessage {
|
||||
|
||||
private Block blockToFind;
|
||||
private int metaToFind;
|
||||
|
||||
public FindBlockRequest(Block block, int meta) {
|
||||
this.blockToFind = block;
|
||||
this.metaToFind = meta;
|
||||
}
|
||||
|
||||
public FindBlockRequest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
blockToFind = Block.getBlockById(buf.readShort());
|
||||
metaToFind = buf.readShort();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeShort(Block.getIdFromBlock(blockToFind));
|
||||
buf.writeShort(metaToFind);
|
||||
}
|
||||
|
||||
public Block getBlockToFind() {
|
||||
return blockToFind;
|
||||
}
|
||||
|
||||
public int getMetaToFind() {
|
||||
return metaToFind;
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<FindBlockRequest, BlockFoundResponse> {
|
||||
|
||||
@Override
|
||||
public BlockFoundResponse onMessage(FindBlockRequest message, MessageContext ctx) {
|
||||
if (message.blockToFind != null && message.blockToFind != Blocks.air) {
|
||||
FindIt.getBlockFindService().handleRequest(ctx.getServerHandler().playerEntity, message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.gtnh.findit.service.cooldown;
|
||||
|
||||
import com.gtnh.findit.FindItConfig;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
public class SearchCooldownService {
|
||||
|
||||
private final WeakHashMap<EntityPlayerMP, Long> lastSearchTime = new WeakHashMap<>();
|
||||
|
||||
/**
|
||||
* @return true if player has active cooldown
|
||||
*/
|
||||
public boolean checkSearchCooldown(EntityPlayerMP player) {
|
||||
long time = player.getServerForPlayer().func_73046_m().getTickCounter();
|
||||
Long lastTime = lastSearchTime.get(player);
|
||||
|
||||
if (lastTime != null && time - lastTime < FindItConfig.SEARCH_COOLDOWN) {
|
||||
return true;
|
||||
}
|
||||
lastSearchTime.put(player, time);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.gtnh.findit.service.itemfinder;
|
||||
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import com.gtnh.findit.FindIt;
|
||||
import com.gtnh.findit.FindItNetwork;
|
||||
import com.gtnh.findit.fx.ParticlePosition;
|
||||
import com.gtnh.findit.fx.SlotHighlighter;
|
||||
import com.gtnh.findit.util.AbstractStackFinder;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ClientItemFindService extends ItemFindService {
|
||||
|
||||
private ContainerHighlightData highlightData = null;
|
||||
|
||||
public ClientItemFindService() {
|
||||
if (!FindIt.isExtraUtilitiesLoaded()) {
|
||||
API.addHashBind("gui.findit.find_item", Keyboard.KEY_T + NEIClientUtils.SHIFT_HASH);
|
||||
}
|
||||
GuiContainerManager.addInputHandler(new ItemFindInputHandler());
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new GuiListener());
|
||||
FMLCommonHandler.instance().bus().register(new TickListener());
|
||||
}
|
||||
|
||||
public void handleResponse(EntityClientPlayerMP player, ItemFoundResponse response) {
|
||||
World world = player.worldObj;
|
||||
|
||||
player.closeScreen();
|
||||
ParticlePosition.highlightBlocks(world, response.getPositions());
|
||||
}
|
||||
|
||||
public void handleSlotHighlight(HighlightSlotsPacket packet) {
|
||||
highlightData = new ContainerHighlightData(packet.getWindowId(), packet.getTargetStack(), packet.getTargetSlots());
|
||||
}
|
||||
|
||||
public class TickListener {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientPostTick(TickEvent.ClientTickEvent event) {
|
||||
if (event.phase != TickEvent.Phase.END) {
|
||||
return;
|
||||
}
|
||||
WorldClient world = Minecraft.getMinecraft().theWorld;
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
|
||||
if (!(screen instanceof GuiContainer)) {
|
||||
return;
|
||||
}
|
||||
GuiContainer gui = (GuiContainer) screen;
|
||||
|
||||
if (highlightData != null) {
|
||||
if (highlightData.windowId == gui.inventorySlots.windowId) {
|
||||
highlightData.updateHighlightedSlots(gui);
|
||||
} else {
|
||||
highlightData = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class GuiListener {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Pre event) {
|
||||
if (!(event.gui instanceof GuiContainer)) {
|
||||
return;
|
||||
}
|
||||
GuiContainer gui = (GuiContainer) event.gui;
|
||||
|
||||
if (highlightData != null && highlightData.windowId == gui.inventorySlots.windowId) {
|
||||
SlotHighlighter.highlightSlots(gui, highlightData.highlightedSlots, 0xFFFF8726);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class ItemFindInputHandler extends AbstractStackFinder {
|
||||
|
||||
@Override
|
||||
protected String getKeyBindId() {
|
||||
return FindIt.isExtraUtilitiesLoaded() ? "gui.xu_ping" : "gui.findit.find_item";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean findStack(ItemStack stack) {
|
||||
FindItNetwork.CHANNEL.sendToServer(new FindItemRequest(stack));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ContainerHighlightData {
|
||||
private final int windowId;
|
||||
private final ItemStack targetStack;
|
||||
private final List<Integer> targetSlots;
|
||||
private final List<Integer> highlightedSlots = new ArrayList<>();
|
||||
|
||||
public ContainerHighlightData(int windowId, ItemStack targetStack, List<Integer> targetSlots) {
|
||||
this.windowId = windowId;
|
||||
this.targetStack = targetStack;
|
||||
this.targetSlots = targetSlots;
|
||||
}
|
||||
|
||||
public void updateHighlightedSlots(GuiContainer gui) {
|
||||
highlightedSlots.clear();
|
||||
|
||||
List<Slot> slots = (List<Slot>) gui.inventorySlots.inventorySlots;
|
||||
Item targetItem = targetStack.getItem();
|
||||
int targetMeta = targetStack.getItemDamage();
|
||||
|
||||
for (int slotId : targetSlots) {
|
||||
if (slotId >= slots.size()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Slot slot = slots.get(slotId);
|
||||
ItemStack stack = slot.getStack();
|
||||
if (stack != null && stack.getItem() == targetItem && stack.getItemDamage() == targetMeta) {
|
||||
highlightedSlots.add(slotId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ClientItemFindService getInstance() {
|
||||
return (ClientItemFindService) FindIt.getItemFindService();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gtnh.findit.service.itemfinder;
|
||||
|
||||
import com.gtnh.findit.FindIt;
|
||||
import com.gtnh.findit.service.blockfinder.BlockFoundResponse;
|
||||
import com.gtnh.findit.util.ProtoUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FindItemRequest implements IMessage {
|
||||
|
||||
private ItemStack stack;
|
||||
|
||||
public FindItemRequest(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public FindItemRequest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
stack = ProtoUtils.readItemStack(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
ProtoUtils.writeItemStack(buf, stack);
|
||||
}
|
||||
|
||||
public ItemStack getStackToFind() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<FindItemRequest, BlockFoundResponse> {
|
||||
|
||||
@Override
|
||||
public BlockFoundResponse onMessage(FindItemRequest message, MessageContext ctx) {
|
||||
if (message.stack != null) {
|
||||
FindIt.getItemFindService().handleRequest(ctx.getServerHandler().playerEntity, message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.gtnh.findit.service.itemfinder;
|
||||
|
||||
import com.gtnh.findit.service.blockfinder.BlockFoundResponse;
|
||||
import com.gtnh.findit.util.ProtoUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HighlightSlotsPacket implements IMessage {
|
||||
|
||||
private int windowId;
|
||||
private ItemStack targetStack;
|
||||
private List<Integer> targetSlots;
|
||||
|
||||
public HighlightSlotsPacket(int windowId, ItemStack targetStack, List<Integer> targetSlots) {
|
||||
this.windowId = windowId;
|
||||
this.targetStack = targetStack;
|
||||
this.targetSlots = targetSlots;
|
||||
}
|
||||
|
||||
public HighlightSlotsPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
windowId = buf.readInt();
|
||||
targetStack = ProtoUtils.readItemStack(buf);
|
||||
|
||||
int slotCount = buf.readInt();
|
||||
targetSlots = new ArrayList<>(slotCount);
|
||||
for (int i = 0; i < slotCount; i++) {
|
||||
targetSlots.add((int) buf.readShort());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(windowId);
|
||||
ProtoUtils.writeItemStack(buf, targetStack);
|
||||
|
||||
buf.writeInt(targetSlots.size());
|
||||
targetSlots.forEach(buf::writeShort);
|
||||
}
|
||||
|
||||
public int getWindowId() {
|
||||
return windowId;
|
||||
}
|
||||
|
||||
public ItemStack getTargetStack() {
|
||||
return targetStack;
|
||||
}
|
||||
|
||||
public List<Integer> getTargetSlots() {
|
||||
return targetSlots;
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<HighlightSlotsPacket, BlockFoundResponse> {
|
||||
|
||||
@Override
|
||||
public BlockFoundResponse onMessage(HighlightSlotsPacket message, MessageContext ctx) {
|
||||
if (message.getTargetStack() != null) {
|
||||
ClientItemFindService.getInstance().handleSlotHighlight(message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.gtnh.findit.service.itemfinder;
|
||||
|
||||
import com.gtnh.findit.FindIt;
|
||||
import com.gtnh.findit.FindItConfig;
|
||||
import com.gtnh.findit.FindItNetwork;
|
||||
import com.gtnh.findit.util.WorldUtils;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryLargeChest;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ItemFindService {
|
||||
|
||||
private final Map<EntityPlayerMP, ItemFoundResult> lastResults = new HashMap<>();
|
||||
private final Map<EntityPlayerMP, Integer> lastProcessedContainers = new HashMap<>(); // (player) -> (windowId)
|
||||
|
||||
public ItemFindService() {
|
||||
FindItNetwork.registerMessage(FindItemRequest.Handler.class, FindItemRequest.class, Side.SERVER);
|
||||
FindItNetwork.registerMessage(ItemFoundResponse.Handler.class, ItemFoundResponse.class, Side.CLIENT);
|
||||
FindItNetwork.registerMessage(HighlightSlotsPacket.Handler.class, HighlightSlotsPacket.class, Side.CLIENT);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new ContainerListener());
|
||||
}
|
||||
|
||||
private ItemFoundResult getLastFoundResult(EntityPlayerMP player) {
|
||||
ItemFoundResult lastResult = lastResults.get(player);
|
||||
if (lastResult != null && !lastResult.isValid(player.getEntityWorld())) {
|
||||
lastResults.remove(player);
|
||||
return null;
|
||||
}
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
public void handleRequest(EntityPlayerMP player, FindItemRequest request) {
|
||||
if (FindIt.getCooldownService().checkSearchCooldown(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Item itemToFind = request.getStackToFind().getItem();
|
||||
int metaToFind = request.getStackToFind().getItemDamage();
|
||||
|
||||
List<ChunkPosition> positions = new ArrayList<>();
|
||||
|
||||
tileIter:
|
||||
for (TileEntity tileEntity : WorldUtils.getTileEntitiesAround(player, FindItConfig.SEARCH_RADIUS)) {
|
||||
try {
|
||||
if (!(tileEntity instanceof IInventory)) {
|
||||
continue;
|
||||
}
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int slot = 0; slot < inventory.getSizeInventory(); slot++) {
|
||||
ItemStack stackInSlot = inventory.getStackInSlot(slot);
|
||||
if (stackInSlot == null || stackInSlot.getItem() != itemToFind) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!itemToFind.getHasSubtypes() || stackInSlot.getItemDamage() == metaToFind) {
|
||||
positions.add(new ChunkPosition(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
|
||||
if (positions.size() == FindItConfig.MAX_RESPONSE_SIZE) {
|
||||
break tileIter;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (!positions.isEmpty()) {
|
||||
ItemFoundResult foundResult = new ItemFindService.ItemFoundResult(
|
||||
request.getStackToFind(), positions,
|
||||
player.getEntityWorld().getTotalWorldTime()
|
||||
);
|
||||
|
||||
lastResults.put(player, foundResult);
|
||||
FindItNetwork.CHANNEL.sendTo(new ItemFoundResponse(request.getStackToFind(), positions), player);
|
||||
}
|
||||
}
|
||||
|
||||
private void processOpenContainer(EntityPlayerMP player) {
|
||||
lastProcessedContainers.put(player, player.openContainer.windowId);
|
||||
Container container = player.openContainer;
|
||||
|
||||
ItemFoundResult lastFoundResult = getLastFoundResult(player);
|
||||
if (lastFoundResult == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Slot> slots = (List<Slot>) container.inventorySlots;
|
||||
List<Integer> targetSlots = new ArrayList<>();
|
||||
Set<ChunkPosition> tilePositions = new HashSet<>();
|
||||
|
||||
for (int slotId = 0; slotId < slots.size(); slotId++) {
|
||||
Slot slot = slots.get(slotId);
|
||||
IInventory inventory = getSlotTrueInventory(slot);
|
||||
if (!(inventory instanceof TileEntity)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TileEntity tile = (TileEntity) inventory;
|
||||
ChunkPosition tilePos = new ChunkPosition(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
|
||||
if (lastFoundResult.containsPosition(tilePos)) {
|
||||
targetSlots.add(slotId);
|
||||
tilePositions.add(tilePos);
|
||||
|
||||
if (targetSlots.size() >= 256) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!targetSlots.isEmpty()) {
|
||||
tilePositions.forEach(lastFoundResult::pollPosition);
|
||||
|
||||
FindItNetwork.CHANNEL.sendTo(
|
||||
new HighlightSlotsPacket(container.windowId, lastFoundResult.foundStack, targetSlots),
|
||||
player
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private IInventory getSlotTrueInventory(Slot slot) {
|
||||
if (slot.inventory instanceof InventoryLargeChest) {
|
||||
InventoryLargeChest largeChest = (InventoryLargeChest) slot.inventory;
|
||||
return slot.slotNumber < largeChest.upperChest.getSizeInventory() ? largeChest.upperChest : largeChest.lowerChest;
|
||||
}
|
||||
return slot.inventory;
|
||||
}
|
||||
|
||||
public class ContainerListener {
|
||||
|
||||
// called every tick to check if player can interact with container
|
||||
@SubscribeEvent
|
||||
public void onContainerOpen(PlayerOpenContainerEvent event) {
|
||||
if (event.entityPlayer.worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
EntityPlayerMP player = (EntityPlayerMP) event.entityPlayer;
|
||||
|
||||
// may not spend time to process player inventory
|
||||
if (player.openContainer == player.inventoryContainer) {
|
||||
return;
|
||||
}
|
||||
|
||||
int lastProcessedContainer = lastProcessedContainers.getOrDefault(player, -1);
|
||||
if (player.openContainer.windowId != lastProcessedContainer) {
|
||||
processOpenContainer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemFoundResult {
|
||||
private final ItemStack foundStack;
|
||||
private final Set<ChunkPosition> positions = new HashSet<>();
|
||||
private final long responseTime;
|
||||
|
||||
public ItemFoundResult(ItemStack foundStack, List<ChunkPosition> positions, long responseTime) {
|
||||
this.foundStack = foundStack;
|
||||
this.positions.addAll(positions);
|
||||
this.responseTime = responseTime;
|
||||
}
|
||||
|
||||
public ItemStack getFoundStack() {
|
||||
return foundStack;
|
||||
}
|
||||
|
||||
public boolean isValid(World world) {
|
||||
return !positions.isEmpty() && world.getTotalWorldTime() - responseTime < 20 * 60; // 60 sec
|
||||
}
|
||||
|
||||
public boolean containsPosition(ChunkPosition position) {
|
||||
return positions.contains(position);
|
||||
}
|
||||
|
||||
public void pollPosition(ChunkPosition position) {
|
||||
positions.remove(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.gtnh.findit.service.itemfinder;
|
||||
|
||||
import com.gtnh.findit.util.ProtoUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemFoundResponse implements IMessage {
|
||||
|
||||
private ItemStack foundStack;
|
||||
private List<ChunkPosition> positions;
|
||||
|
||||
public ItemFoundResponse(ItemStack foundStack, List<ChunkPosition> positions) {
|
||||
this.foundStack = foundStack;
|
||||
this.positions = positions;
|
||||
}
|
||||
|
||||
public ItemFoundResponse() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
foundStack = ProtoUtils.readItemStack(buf);
|
||||
positions = ProtoUtils.readPositions(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
ProtoUtils.writeItemStack(buf, foundStack);
|
||||
ProtoUtils.writePositions(buf, positions);
|
||||
}
|
||||
|
||||
public ItemStack getFoundStack() {
|
||||
return foundStack;
|
||||
}
|
||||
|
||||
public List<ChunkPosition> getPositions() {
|
||||
return positions;
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<ItemFoundResponse, IMessage> {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IMessage onMessage(ItemFoundResponse message, MessageContext ctx) {
|
||||
if (message.foundStack != null && !message.positions.isEmpty()) {
|
||||
ClientItemFindService.getInstance().handleResponse(Minecraft.getMinecraft().thePlayer, message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.gtnh.findit.util;
|
||||
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerInputHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class AbstractStackFinder implements IContainerInputHandler {
|
||||
|
||||
protected abstract String getKeyBindId();
|
||||
|
||||
protected abstract boolean findStack(ItemStack stack);
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiContainer window, char c, int key) {
|
||||
|
||||
if (!NEIClientConfig.isKeyHashDown(getKeyBindId())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LayoutManager layout = LayoutManager.instance();
|
||||
if (layout == null || LayoutManager.itemPanel == null || NEIClientConfig.isHidden()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack stack = GuiContainerManager.getStackMouseOver(window);
|
||||
if (stack == null || stack.getItem() == null) {
|
||||
return false;
|
||||
}
|
||||
return findStack(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyTyped(GuiContainer guiContainer, char c, int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean lastKeyTyped(GuiContainer guiContainer, char c, int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiContainer guiContainer, int i, int i1, int i2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(GuiContainer guiContainer, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseUp(GuiContainer guiContainer, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer guiContainer, int i, int i1, int i2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseScrolled(GuiContainer guiContainer, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDragged(GuiContainer guiContainer, int i, int i1, int i2, long l) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.gtnh.findit.util;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ProtoUtils {
|
||||
|
||||
public static void writePositions(ByteBuf buf, List<ChunkPosition> positions) {
|
||||
buf.writeInt(positions.size());
|
||||
for (ChunkPosition pos : positions) {
|
||||
buf.writeInt(pos.chunkPosX);
|
||||
buf.writeByte(pos.chunkPosY);
|
||||
buf.writeInt(pos.chunkPosZ);
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeItemStack(ByteBuf buf, ItemStack stack) {
|
||||
PacketBuffer packetBuffer = new PacketBuffer(buf);
|
||||
try {
|
||||
packetBuffer.writeItemStackToBuffer(stack);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ChunkPosition> readPositions(ByteBuf buf) {
|
||||
int amount = buf.readInt();
|
||||
List<ChunkPosition> positions = new ArrayList<>();
|
||||
while (amount > 0) {
|
||||
final int x = buf.readInt();
|
||||
final int y = buf.readUnsignedByte();
|
||||
final int z = buf.readInt();
|
||||
positions.add(new ChunkPosition(x, y, z));
|
||||
--amount;
|
||||
}
|
||||
return positions;
|
||||
}
|
||||
|
||||
public static ItemStack readItemStack(ByteBuf buf) {
|
||||
PacketBuffer packetBuffer = new PacketBuffer(buf);
|
||||
try {
|
||||
return packetBuffer.readItemStackFromBuffer();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.gtnh.findit.util;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WorldUtils {
|
||||
|
||||
public static List<TileEntity> getTileEntitiesAround(Entity entity, int r) {
|
||||
int x = (int) Math.floor(entity.posX);
|
||||
int y = (int) entity.posY;
|
||||
int z = (int) Math.floor(entity.posZ);
|
||||
return getTileEntitiesInRegion(entity.worldObj, x - r, y - r, z - r, x + r + 1, y + r + 1, z + r + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param (x1,y1,z1) included
|
||||
* @param (x2,y2,z2) excluded
|
||||
*/
|
||||
public static List<TileEntity> getTileEntitiesInRegion(World world, int x1, int y1, int z1, int x2, int y2, int z2) {
|
||||
List<TileEntity> result = new ArrayList<>();
|
||||
int cx1 = x2 >> 4;
|
||||
int cz1 = z2 >> 4;
|
||||
|
||||
for (int cx = x1 >> 4; cx <= cx1; cx++) {
|
||||
for (int cz = z1 >> 4; cz <= cz1; cz++) {
|
||||
Chunk chunk = world.getChunkFromChunkCoords(cx, cz);
|
||||
if (chunk != null) {
|
||||
Map<ChunkPosition, TileEntity> tiles = chunk.chunkTileEntityMap;
|
||||
for (TileEntity tile : tiles.values()) {
|
||||
if (!tile.isInvalid()
|
||||
&& tile.xCoord >= x1 && tile.xCoord < x2
|
||||
&& tile.yCoord >= y1 && tile.yCoord < y2
|
||||
&& tile.zCoord >= z1 && tile.zCoord < z2) {
|
||||
result.add(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
public net.minecraft.client.gui.inventory.GuiContainer field_147003_i #guiLeft
|
||||
public net.minecraft.client.gui.inventory.GuiContainer field_147009_r #guiTop
|
||||
public net.minecraft.inventory.InventoryLargeChest field_70477_b #upperChest
|
||||
public net.minecraft.inventory.InventoryLargeChest field_70478_c #lowerChest
|
||||
@@ -0,0 +1,3 @@
|
||||
nei.options.keys.gui.findit=Find-It Keys
|
||||
nei.options.keys.gui.findit.find_block=Search For Block Nearby
|
||||
nei.options.keys.gui.findit.find_item=Search For Item In Nearby Inventories
|
||||
@@ -0,0 +1,3 @@
|
||||
nei.options.keys.gui.findit=Find-It клавиши
|
||||
nei.options.keys.gui.findit.find_block=Поиск блока поблизости
|
||||
nei.options.keys.gui.findit.find_item=Поиск предмета в инвентарях поблизости
|
||||
@@ -0,0 +1,4 @@
|
||||
nei.options.keys.gui.findit=搜索世界
|
||||
nei.options.keys.gui.findit.find_block=搜索附近的方块
|
||||
nei.options.keys.gui.findit.find_item=搜索附近库存中的物品
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 274 B |
@@ -1 +0,0 @@
|
||||
nei.options.keys.gui.findit=Search the world
|
||||
@@ -1,20 +1,16 @@
|
||||
[
|
||||
{
|
||||
"modid": "findit",
|
||||
"name": "FindIt",
|
||||
"name": "${modName}",
|
||||
"description": "Now where did I put that EV mixer...",
|
||||
"version": "${version}",
|
||||
"mcversion": "${mcversion}",
|
||||
"url": "",
|
||||
"version": "${modVersion}",
|
||||
"mcversion": "${minecraftVersion}",
|
||||
"url": "https://github.com/GTNewHorizons/FindIt",
|
||||
"updateUrl": "",
|
||||
"authorList": [
|
||||
"mitchej123"
|
||||
],
|
||||
"authorList": ["mitchej123"],
|
||||
"credits": "Heavily inspired from Buuz135/findme",
|
||||
"logoFile": "",
|
||||
"screenshots": [],
|
||||
"dependencies": [
|
||||
"NotEnoughItems"
|
||||
]
|
||||
"dependencies": ["NotEnoughItems"]
|
||||
}
|
||||
]
|
||||
Reference in new issue
Block a user