mirror of
https://github.com/GTNewHorizons/FindIt.git
synced 2026-11-24 18:24:21 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d610d598c4 | ||
|
|
707e8582c7 | ||
|
|
64446eef4b | ||
|
|
4ffd7ee108 |
No files matched your search
+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.17-GTNH:dev')
|
||||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.23:dev')
|
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.64:dev')
|
||||||
}
|
}
|
||||||
+5
-4
@@ -33,7 +33,7 @@ channel = stable
|
|||||||
mappingsVersion = 12
|
mappingsVersion = 12
|
||||||
|
|
||||||
# Defines 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 default username for testing your mod. You can always override this per-run by running
|
# Select a default username for testing your mod. You can always override this per-run by running
|
||||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||||
@@ -61,6 +61,9 @@ gradleTokenModId =
|
|||||||
# [DEPRECATED] Mod name replacement token.
|
# [DEPRECATED] Mod name replacement token.
|
||||||
gradleTokenModName =
|
gradleTokenModName =
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod Group replacement token.
|
||||||
|
gradleTokenGroupName =
|
||||||
|
|
||||||
# [DEPRECATED]
|
# [DEPRECATED]
|
||||||
# Multiple source files can be defined here by providing a comma-separated 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";
|
||||||
@@ -123,7 +126,7 @@ includeWellKnownRepositories = true
|
|||||||
usesMavenPublishing = true
|
usesMavenPublishing = true
|
||||||
|
|
||||||
# Maven repository to publish the mod to.
|
# Maven repository to publish the mod to.
|
||||||
# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/
|
# 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.
|
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||||
#
|
#
|
||||||
@@ -187,5 +190,3 @@ curseForgeRelations =
|
|||||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||||
# ideaCheckSpotlessOnBuild = true
|
# ideaCheckSpotlessOnBuild = true
|
||||||
|
|
||||||
# Non-GTNH properties
|
|
||||||
gradleTokenGroupName =
|
|
||||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8'
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.14'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -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,39 @@
|
|||||||
|
package com.gtnh.findit.util;
|
||||||
|
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.ChunkPosition;
|
||||||
|
|
||||||
|
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, ChunkPosition target) {
|
||||||
|
double deltaX = target.chunkPosX - player.xCoord;
|
||||||
|
double deltaY = target.chunkPosY - player.yCoord;
|
||||||
|
double deltaZ = target.chunkPosZ - 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,31 @@
|
|||||||
|
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);
|
||||||
|
ChunkPosition first = targets.remove(0);
|
||||||
|
|
||||||
|
AxisUtils.AxisPair pair = AxisUtils.calculateAxisPair(playerVec, first);
|
||||||
|
|
||||||
|
player.rotationYaw = pair.yaw();
|
||||||
|
player.rotationPitch = pair.pitch();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user