mirror of
https://github.com/GTNewHorizons/FindIt.git
synced 2026-11-24 18:24:21 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d6ce05d9e | ||
|
|
0c2a7beed9 | ||
|
|
f1313bfc48 |
No files matched your search
+2
-1602
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.5.3-GTNH:dev')
|
implementation('com.github.GTNewHorizons:NotEnoughItems:2.5.18-GTNH:dev')
|
||||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.23:dev')
|
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.68:dev')
|
||||||
}
|
}
|
||||||
+91
-41
@@ -1,76 +1,104 @@
|
|||||||
|
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
|
||||||
|
# LOCAL to test local config updates.
|
||||||
|
gtnh.settings.blowdryerTag = 0.2.0
|
||||||
|
|
||||||
|
# Human-readable mod name, available for mcmod.info population.
|
||||||
modName = FindIt
|
modName = FindIt
|
||||||
|
|
||||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||||
|
# Conventionally lowercase.
|
||||||
modId = findit
|
modId = findit
|
||||||
|
|
||||||
|
# Root package of the mod, used to find various classes in other properties,
|
||||||
|
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||||
modGroup = com.gtnh.findit
|
modGroup = com.gtnh.findit
|
||||||
|
|
||||||
# WHY is there no version field?
|
# Whether to use modGroup as the maven publishing group.
|
||||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
useModGroupForPublishing = false
|
||||||
|
|
||||||
# Will update your build.gradle automatically whenever an update is available
|
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||||
autoUpdateBuildScript = false
|
autoUpdateBuildScript = false
|
||||||
|
|
||||||
|
# Version of Minecraft to target
|
||||||
minecraftVersion = 1.7.10
|
minecraftVersion = 1.7.10
|
||||||
|
|
||||||
|
# Version of Minecraft Forge to target
|
||||||
forgeVersion = 10.13.4.1614
|
forgeVersion = 10.13.4.1614
|
||||||
|
|
||||||
# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
|
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||||
channel = stable
|
channel = stable
|
||||||
|
|
||||||
|
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||||
mappingsVersion = 12
|
mappingsVersion = 12
|
||||||
|
|
||||||
# Define other MCP mappings for dependency deobfuscation
|
# Defines other MCP mappings for dependency deobfuscation.
|
||||||
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||||
|
|
||||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
# Select a default username for testing your mod. You can always override this per-run by running
|
||||||
# restart Minecraft in development. Choose this dependent on your mod:
|
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||||
# 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
|
developmentEnvironmentUserName = Developer
|
||||||
|
|
||||||
# Enables using modern java syntax (up to version 17) via Jabel, while still targetting JVM 8.
|
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||||
# See https://github.com/bsideup/jabel for details on how this works.
|
# See https://github.com/bsideup/jabel for details on how this works.
|
||||||
enableModernJavaSyntax = true
|
enableModernJavaSyntax = true
|
||||||
|
|
||||||
# Enables injecting missing generics into the decompiled source code for a better coding experience
|
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||||
# Turns most publically visible List, Map, etc. into proper List<Type>, Map<K, V> types
|
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||||
enableGenericInjection = false
|
enableGenericInjection = false
|
||||||
|
|
||||||
# Generate a class with String fields for the mod id, name, version and group name named with the fields below
|
# Generate a class with a String field for the mod version named as defined below.
|
||||||
|
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||||
|
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||||
generateGradleTokenClass = com.gtnh.findit.Tags
|
generateGradleTokenClass = com.gtnh.findit.Tags
|
||||||
gradleTokenModId =
|
|
||||||
gradleTokenModName =
|
# Name of the token containing the project's current version to generate/replace.
|
||||||
gradleTokenVersion = VERSION
|
gradleTokenVersion = VERSION
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod ID replacement token.
|
||||||
|
gradleTokenModId =
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod name replacement token.
|
||||||
|
gradleTokenModName =
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod Group replacement token.
|
||||||
gradleTokenGroupName =
|
gradleTokenGroupName =
|
||||||
|
|
||||||
# [DEPRECATED]
|
# [DEPRECATED]
|
||||||
# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java
|
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
# 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
|
# 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, [...])
|
# version in @Mod([...], version = VERSION, [...]).
|
||||||
# Leave these properties empty to skip individual token replacements
|
# Leave these properties empty to skip individual token replacements.
|
||||||
replaceGradleTokenInFile =
|
replaceGradleTokenInFile =
|
||||||
|
|
||||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
# 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.
|
# leave this property empty.
|
||||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
||||||
apiPackage =
|
apiPackage =
|
||||||
|
|
||||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
# 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
|
# There can be multiple files in a space-separated list.
|
||||||
|
# Example value: mymodid_at.cfg nei_at.cfg
|
||||||
accessTransformersFile = findit_at.cfg
|
accessTransformersFile = findit_at.cfg
|
||||||
|
|
||||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||||
usesMixins = false
|
usesMixins = false
|
||||||
# Adds some debug arguments like verbose output and export
|
|
||||||
|
# Adds some debug arguments like verbose output and class export.
|
||||||
usesMixinDebug = false
|
usesMixinDebug = false
|
||||||
|
|
||||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||||
mixinPlugin =
|
mixinPlugin =
|
||||||
|
|
||||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||||
mixinsPackage =
|
mixinsPackage =
|
||||||
|
|
||||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||||
# This parameter is for legacy compatibility only
|
# This parameter is for legacy compatibility only
|
||||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||||
coreModClass =
|
coreModClass =
|
||||||
|
|
||||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
# 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!
|
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||||
containsMixinsAndOrCoreModOnly = false
|
containsMixinsAndOrCoreModOnly = false
|
||||||
@@ -78,22 +106,32 @@ containsMixinsAndOrCoreModOnly = false
|
|||||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||||
forceEnableMixins = false
|
forceEnableMixins = false
|
||||||
|
|
||||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
|
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||||
# responsibility check the licence and request permission for distribution, if required.
|
# responsibility to check the license and request permission for distribution if required.
|
||||||
usesShadowedDependencies = false
|
usesShadowedDependencies = false
|
||||||
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
|
|
||||||
|
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
||||||
# their own classes, making the minimization unreliable.
|
# their own classes, making the minimization unreliable.
|
||||||
minimizeShadowedDependencies = true
|
minimizeShadowedDependencies = true
|
||||||
|
|
||||||
# If disabled, won't rename the shadowed classes.
|
# If disabled, won't rename the shadowed classes.
|
||||||
relocateShadowedDependencies = true
|
relocateShadowedDependencies = true
|
||||||
|
|
||||||
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories
|
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
|
||||||
includeWellKnownRepositories = true
|
includeWellKnownRepositories = true
|
||||||
|
|
||||||
# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.
|
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||||
|
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||||
|
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||||
|
usesMavenPublishing = true
|
||||||
|
|
||||||
|
# Maven repository to publish the mod to.
|
||||||
|
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||||
|
|
||||||
|
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||||
|
#
|
||||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||||
# Leave this empty if you don't want to publish on Modrinth.
|
# Leave this empty if you don't want to publish to Modrinth.
|
||||||
modrinthProjectId =
|
modrinthProjectId =
|
||||||
|
|
||||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||||
@@ -105,9 +143,8 @@ modrinthProjectId =
|
|||||||
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||||
modrinthRelations =
|
modrinthRelations =
|
||||||
|
|
||||||
|
|
||||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||||
|
#
|
||||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||||
# Leave this empty if you don't want to publish on CurseForge.
|
# Leave this empty if you don't want to publish on CurseForge.
|
||||||
curseForgeProjectId =
|
curseForgeProjectId =
|
||||||
@@ -117,26 +154,39 @@ curseForgeProjectId =
|
|||||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||||
# and the name is the CurseForge project slug of the other mod.
|
# and the name is the CurseForge project slug of the other mod.
|
||||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||||
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||||
curseForgeRelations =
|
curseForgeRelations =
|
||||||
|
|
||||||
|
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||||
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
|
||||||
# projects. New projects should not use this parameter.
|
# projects. New projects should not use this parameter.
|
||||||
# customArchiveBaseName =
|
# customArchiveBaseName =
|
||||||
|
|
||||||
# Optional parameter to prevent the source code from being published
|
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||||
# noPublishedSources =
|
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||||
|
# The check is ONLY performed if the version is a git tag.
|
||||||
|
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
||||||
|
# versionPattern =
|
||||||
|
|
||||||
# Uncomment this to disable spotless checks
|
# Uncomment to prevent the source code from being published.
|
||||||
|
# noPublishedSources = true
|
||||||
|
|
||||||
|
# Uncomment this to disable Spotless checks.
|
||||||
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||||
# That is, if there is no other active fork/upstream, NEVER change this.
|
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||||
# disableSpotless = true
|
# disableSpotless = true
|
||||||
|
|
||||||
# Override the IDEA build type. Valid value is "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
||||||
|
# disableCheckstyle = true
|
||||||
|
|
||||||
|
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
||||||
# (force use delegated build).
|
# (force use delegated build).
|
||||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||||
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be always native build.
|
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
||||||
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
||||||
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
||||||
# ideaOverrideBuildType = idea
|
# ideaOverrideBuildType = idea
|
||||||
|
|
||||||
|
# Whether IDEA should run spotless checks when pressing the Build button.
|
||||||
|
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||||
|
# ideaCheckSpotlessOnBuild = true
|
||||||
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
Vendored
+10
-10
@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
|
|||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if %ERRORLEVEL% equ 0 goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
|||||||
+3
-7
@@ -6,6 +6,7 @@ pluginManagement {
|
|||||||
name "GTNH Maven"
|
name "GTNH Maven"
|
||||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||||
mavenContent {
|
mavenContent {
|
||||||
|
includeGroup("com.gtnewhorizons")
|
||||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,12 +17,7 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.diffplug.blowdryerSetup' version '1.7.1'
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.14'
|
||||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blowdryerSetup {
|
|
||||||
repoSubfolder 'gtnhShared'
|
|
||||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
|
||||||
//devLocal '.' // Use this when testing config updates locally
|
|
||||||
}
|
|
||||||
@@ -9,6 +9,7 @@ public class FindItConfig {
|
|||||||
public static int SEARCH_RADIUS = 16;
|
public static int SEARCH_RADIUS = 16;
|
||||||
public static int SEARCH_COOLDOWN = 10;
|
public static int SEARCH_COOLDOWN = 10;
|
||||||
public static int MAX_RESPONSE_SIZE = 20;
|
public static int MAX_RESPONSE_SIZE = 20;
|
||||||
|
public static boolean ENABLE_ROTATE_VIEW = false;
|
||||||
|
|
||||||
public static void setup(final File file) {
|
public static void setup(final File file) {
|
||||||
final Configuration config = new Configuration(file);
|
final Configuration config = new Configuration(file);
|
||||||
@@ -26,6 +27,12 @@ public class FindItConfig {
|
|||||||
"MaxResponseSize",
|
"MaxResponseSize",
|
||||||
"20",
|
"20",
|
||||||
"Maximum number of positions that can be displayed by item/block search").getInt();
|
"Maximum number of positions that can be displayed by item/block search").getInt();
|
||||||
|
|
||||||
|
ENABLE_ROTATE_VIEW = config.get(
|
||||||
|
Configuration.CATEGORY_GENERAL,
|
||||||
|
"EnableRotateView",
|
||||||
|
"false",
|
||||||
|
"Rotate player's view when searched").getBoolean();
|
||||||
} catch (Exception ignore) {} finally {
|
} catch (Exception ignore) {} finally {
|
||||||
if (config.hasChanged()) config.save();
|
if (config.hasChanged()) config.save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.gtnh.findit.service.blockfinder;
|
package com.gtnh.findit.service.blockfinder;
|
||||||
|
|
||||||
|
import static com.gtnh.findit.util.ClientFinderHelperUtils.lookAtTarget;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
@@ -8,6 +10,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import com.gtnh.findit.FindIt;
|
import com.gtnh.findit.FindIt;
|
||||||
|
import com.gtnh.findit.FindItConfig;
|
||||||
import com.gtnh.findit.FindItNetwork;
|
import com.gtnh.findit.FindItNetwork;
|
||||||
import com.gtnh.findit.fx.ParticlePosition;
|
import com.gtnh.findit.fx.ParticlePosition;
|
||||||
import com.gtnh.findit.util.AbstractStackFinder;
|
import com.gtnh.findit.util.AbstractStackFinder;
|
||||||
@@ -25,6 +28,10 @@ public class ClientBlockFindService extends BlockFindService {
|
|||||||
public void handleResponse(EntityClientPlayerMP player, BlockFoundResponse response) {
|
public void handleResponse(EntityClientPlayerMP player, BlockFoundResponse response) {
|
||||||
player.closeScreen();
|
player.closeScreen();
|
||||||
ParticlePosition.highlightBlocks(player.worldObj, response.getPositions());
|
ParticlePosition.highlightBlocks(player.worldObj, response.getPositions());
|
||||||
|
|
||||||
|
if (FindItConfig.ENABLE_ROTATE_VIEW) {
|
||||||
|
lookAtTarget(player, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class BlockFindInputHandler extends AbstractStackFinder {
|
private static class BlockFindInputHandler extends AbstractStackFinder {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.gtnh.findit.service.itemfinder;
|
package com.gtnh.findit.service.itemfinder;
|
||||||
|
|
||||||
|
import static com.gtnh.findit.util.ClientFinderHelperUtils.lookAtTarget;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -18,6 +20,7 @@ import net.minecraftforge.common.MinecraftForge;
|
|||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import com.gtnh.findit.FindIt;
|
import com.gtnh.findit.FindIt;
|
||||||
|
import com.gtnh.findit.FindItConfig;
|
||||||
import com.gtnh.findit.FindItNetwork;
|
import com.gtnh.findit.FindItNetwork;
|
||||||
import com.gtnh.findit.fx.ParticlePosition;
|
import com.gtnh.findit.fx.ParticlePosition;
|
||||||
import com.gtnh.findit.fx.SlotHighlighter;
|
import com.gtnh.findit.fx.SlotHighlighter;
|
||||||
@@ -50,6 +53,10 @@ public class ClientItemFindService extends ItemFindService {
|
|||||||
|
|
||||||
player.closeScreen();
|
player.closeScreen();
|
||||||
ParticlePosition.highlightBlocks(world, response.getPositions());
|
ParticlePosition.highlightBlocks(world, response.getPositions());
|
||||||
|
|
||||||
|
if (FindItConfig.ENABLE_ROTATE_VIEW) {
|
||||||
|
lookAtTarget(player, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleSlotHighlight(HighlightSlotsPacket packet) {
|
public void handleSlotHighlight(HighlightSlotsPacket packet) {
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.gtnh.findit.util;
|
||||||
|
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
|
||||||
|
public class AxisUtils {
|
||||||
|
|
||||||
|
public static final class AxisPair {
|
||||||
|
|
||||||
|
private final float yaw;
|
||||||
|
private final float pitch;
|
||||||
|
|
||||||
|
public AxisPair(float yaw, float pitch) {
|
||||||
|
this.yaw = yaw;
|
||||||
|
this.pitch = pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float yaw() {
|
||||||
|
return yaw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float pitch() {
|
||||||
|
return pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AxisPair calculateAxisPair(Vec3 player, Vec3 target) {
|
||||||
|
double deltaX = target.xCoord - player.xCoord;
|
||||||
|
double deltaY = target.yCoord - player.yCoord;
|
||||||
|
double deltaZ = target.zCoord - player.zCoord;
|
||||||
|
|
||||||
|
double distanceXZ = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
|
||||||
|
|
||||||
|
float yaw = (float) Math.toDegrees(Math.atan2(-deltaX, deltaZ));
|
||||||
|
float pitch = (float) Math.toDegrees(Math.atan2(-deltaY, distanceXZ));
|
||||||
|
|
||||||
|
return new AxisPair(yaw, pitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.gtnh.findit.util;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.ChunkPosition;
|
||||||
|
|
||||||
|
import com.gtnh.findit.service.blockfinder.BlockFoundResponse;
|
||||||
|
import com.gtnh.findit.service.itemfinder.ItemFoundResponse;
|
||||||
|
|
||||||
|
public class ClientFinderHelperUtils {
|
||||||
|
|
||||||
|
public static void lookAtTarget(EntityClientPlayerMP player, ItemFoundResponse response) {
|
||||||
|
rotateViewHelper(player, response.getPositions());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void lookAtTarget(EntityClientPlayerMP player, BlockFoundResponse response) {
|
||||||
|
rotateViewHelper(player, response.getPositions());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void rotateViewHelper(EntityClientPlayerMP player, List<ChunkPosition> targets) {
|
||||||
|
Vec3 playerVec = player.getPosition(1.0F);
|
||||||
|
Vec3 first = center(targets.remove(0));
|
||||||
|
|
||||||
|
AxisUtils.AxisPair pair = AxisUtils.calculateAxisPair(playerVec, first);
|
||||||
|
|
||||||
|
player.rotationYaw = pair.yaw();
|
||||||
|
player.rotationPitch = pair.pitch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vec3 center(ChunkPosition p) {
|
||||||
|
return Vec3.createVectorHelper(p.chunkPosX + 0.5, p.chunkPosY + 0.5, p.chunkPosZ + 0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user