mirror of
https://github.com/GTNewHorizons/FindIt.git
synced 2026-11-24 18:24:21 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6795089c33 | ||
|
|
9a54f7c6b2 | ||
|
|
d9c5b0e035 | ||
|
|
fe1c5123c7 | ||
|
|
641288386d |
No files matched your search
@@ -29,3 +29,4 @@ src/main/resources/mixins.*.json
|
|||||||
*.bat
|
*.bat
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
!gradlew.bat
|
!gradlew.bat
|
||||||
|
layout.json
|
||||||
+5
-3
@@ -1,7 +1,9 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.6.11-GTNH:dev')
|
implementation('com.github.GTNewHorizons:NotEnoughItems:2.6.38-GTNH:dev')
|
||||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.56:dev')
|
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.50.17:dev')
|
||||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.8.6:dev')
|
compileOnly('com.github.GTNewHorizons:EnderIO:2.8.17:dev')
|
||||||
|
compileOnly('com.github.GTNewHorizons:Draconic-Evolution:1.3.10-GTNH:dev')
|
||||||
|
api('com.github.GTNewHorizons:ForestryMC:4.9.16:dev')
|
||||||
}
|
}
|
||||||
+12
-1
@@ -85,6 +85,11 @@ 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
|
||||||
|
|
||||||
|
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
||||||
|
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
||||||
|
# Mixin classes will have access to "main" classes, but not the other way around.
|
||||||
|
separateMixinSourceSet =
|
||||||
|
|
||||||
# Adds some debug arguments like verbose output and class export.
|
# Adds some debug arguments like verbose output and class export.
|
||||||
usesMixinDebug = false
|
usesMixinDebug = false
|
||||||
|
|
||||||
@@ -117,9 +122,15 @@ 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, Modrinth, and some more well-known 1.7.10 repositories.
|
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||||
includeWellKnownRepositories = true
|
includeWellKnownRepositories = true
|
||||||
|
|
||||||
|
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
||||||
|
# list of strings, with the acceptable keys being(case does not matter):
|
||||||
|
# cursemaven
|
||||||
|
# modrinth
|
||||||
|
excludeWellKnownRepositories =
|
||||||
|
|
||||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
# 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.
|
# 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.
|
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
+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.8-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
@@ -84,7 +86,8 @@ done
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||||
|
' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
|||||||
Vendored
+2
@@ -13,6 +13,8 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23'
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -28,9 +28,11 @@ public class FindIt {
|
|||||||
@Mod.Instance(MOD_ID)
|
@Mod.Instance(MOD_ID)
|
||||||
public static FindIt INSTANCE;
|
public static FindIt INSTANCE;
|
||||||
|
|
||||||
private boolean extraUtilitiesLoaded;
|
private boolean isDraconicEvolutionLoaded;
|
||||||
private boolean gregTechloaded;
|
private boolean isEnderIOLoaded;
|
||||||
private boolean enderIOloaded;
|
private boolean isExtraUtilitiesLoaded;
|
||||||
|
private boolean isForestryLoaded;
|
||||||
|
private boolean isGregTechLoaded;
|
||||||
|
|
||||||
private SearchCooldownService cooldownService;
|
private SearchCooldownService cooldownService;
|
||||||
private BlockFindService blockFindService;
|
private BlockFindService blockFindService;
|
||||||
@@ -38,9 +40,11 @@ public class FindIt {
|
|||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
this.extraUtilitiesLoaded = Loader.isModLoaded("ExtraUtilities");
|
this.isExtraUtilitiesLoaded = Loader.isModLoaded("ExtraUtilities");
|
||||||
this.gregTechloaded = Loader.isModLoaded("gregtech");
|
this.isGregTechLoaded = Loader.isModLoaded("gregtech");
|
||||||
this.enderIOloaded = Loader.isModLoaded("EnderIO");
|
this.isEnderIOLoaded = Loader.isModLoaded("EnderIO");
|
||||||
|
this.isDraconicEvolutionLoaded = Loader.isModLoaded("DraconicEvolution");
|
||||||
|
this.isForestryLoaded = Loader.isModLoaded("Forestry");
|
||||||
|
|
||||||
FindItConfig.setup(event.getSuggestedConfigurationFile());
|
FindItConfig.setup(event.getSuggestedConfigurationFile());
|
||||||
boolean isClient = event.getSide() == Side.CLIENT;
|
boolean isClient = event.getSide() == Side.CLIENT;
|
||||||
@@ -63,14 +67,22 @@ public class FindIt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isExtraUtilitiesLoaded() {
|
public static boolean isExtraUtilitiesLoaded() {
|
||||||
return INSTANCE.extraUtilitiesLoaded;
|
return INSTANCE.isExtraUtilitiesLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isGregTechLoaded() {
|
public static boolean isGregTechLoaded() {
|
||||||
return INSTANCE.gregTechloaded;
|
return INSTANCE.isGregTechLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEnderIOLoaded() {
|
public static boolean isEnderIOLoaded() {
|
||||||
return INSTANCE.enderIOloaded;
|
return INSTANCE.isEnderIOLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isDraconicEvolutionLoaded() {
|
||||||
|
return INSTANCE.isDraconicEvolutionLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isForestryLoaded() {
|
||||||
|
return INSTANCE.isForestryLoaded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,7 @@ public class FindItConfig {
|
|||||||
public static boolean SEARCH_IN_ENDERIO_CONDUITS = false;
|
public static boolean SEARCH_IN_ENDERIO_CONDUITS = false;
|
||||||
public static int ITEM_HIGHLIGHTING_DURATION = 10;
|
public static int ITEM_HIGHLIGHTING_DURATION = 10;
|
||||||
public static int BLOCK_HIGHLIGHTING_DURATION = 8;
|
public static int BLOCK_HIGHLIGHTING_DURATION = 8;
|
||||||
|
public static int ITEM_HIGHLIGHTING_COLOR = 0xFFFF8726;
|
||||||
|
|
||||||
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);
|
||||||
@@ -73,6 +74,14 @@ public class FindItConfig {
|
|||||||
"EnableRotateView",
|
"EnableRotateView",
|
||||||
"false",
|
"false",
|
||||||
"Rotate player's view when searched").getBoolean();
|
"Rotate player's view when searched").getBoolean();
|
||||||
|
|
||||||
|
ITEM_HIGHLIGHTING_COLOR = Integer.parseUnsignedInt(
|
||||||
|
config.get(
|
||||||
|
Configuration.CATEGORY_GENERAL,
|
||||||
|
"ItemHighlightingColor",
|
||||||
|
"FFFF8726",
|
||||||
|
"Item highlighting color as a hexadecimal color code. For example 0xFFFF8726").getString(),
|
||||||
|
16);
|
||||||
} catch (Exception ignore) {} finally {
|
} catch (Exception ignore) {} finally {
|
||||||
if (config.hasChanged()) config.save();
|
if (config.hasChanged()) config.save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,10 +95,14 @@ public class ClientItemFindService extends ItemFindService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// `WorldClient` is only available on the client-side, thus effectively checking if the game is running on
|
||||||
|
// the client. We are only interested in highlighting slots when the player is in a GUI; the operation is
|
||||||
|
// bound client-side.
|
||||||
if (Minecraft.getMinecraft().theWorld == null) {
|
if (Minecraft.getMinecraft().theWorld == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We are only interested in GUIs that contain some kind of inventory.
|
||||||
final GuiScreen screen = Minecraft.getMinecraft().currentScreen;
|
final GuiScreen screen = Minecraft.getMinecraft().currentScreen;
|
||||||
if (!(screen instanceof GuiContainer)) {
|
if (!(screen instanceof GuiContainer)) {
|
||||||
return;
|
return;
|
||||||
@@ -107,26 +111,31 @@ public class ClientItemFindService extends ItemFindService {
|
|||||||
final GuiContainer gui = (GuiContainer) screen;
|
final GuiContainer gui = (GuiContainer) screen;
|
||||||
final HashSet<Slot> highlightedSlots = new HashSet<>();
|
final HashSet<Slot> highlightedSlots = new HashSet<>();
|
||||||
|
|
||||||
|
// If the expiration time has passed, we reset the found item. This is done to prevent the item from being
|
||||||
|
// highlighted indefinitely.
|
||||||
if (System.currentTimeMillis() > expirationTime) {
|
if (System.currentTimeMillis() > expirationTime) {
|
||||||
foundItem = null;
|
foundItem = null;
|
||||||
}
|
}
|
||||||
|
if (foundItem == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (foundItem != null) {
|
// We continue to iterate over each slot of the given GUI's inventory and checking if the slot contains the
|
||||||
@SuppressWarnings("unchecked")
|
// item that we are looking for.
|
||||||
List<Slot> slots = gui.inventorySlots.inventorySlots;
|
@SuppressWarnings("unchecked")
|
||||||
|
List<Slot> slots = gui.inventorySlots.inventorySlots;
|
||||||
|
|
||||||
for (Slot slot : slots) {
|
for (Slot slot : slots) {
|
||||||
if (!(slot.inventory instanceof InventoryPlayer) && foundItem.isStackSatisfies(slot.getStack())) {
|
if (!(slot.inventory instanceof InventoryPlayer) && foundItem.isStackSatisfies(slot.getStack())) {
|
||||||
highlightedSlots.add(slot);
|
highlightedSlots.add(slot);
|
||||||
|
|
||||||
if (highlightedSlots.size() > 256) {
|
if (highlightedSlots.size() > 256) {
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
slotHighlighter.highlightSlots(gui, highlightedSlots, 0xFFFF8726);
|
slotHighlighter.highlightSlots(gui, highlightedSlots, FindItConfig.ITEM_HIGHLIGHTING_COLOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,6 +161,10 @@ public class ClientItemFindService extends ItemFindService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is responsible for removing the NEI ping handler from the list of input handlers. This is done to
|
||||||
|
* prevent the NEI ping handler from interfering with the FindIt keybind.
|
||||||
|
*/
|
||||||
public static class NEIEventListener {
|
public static class NEIEventListener {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@@ -164,6 +177,9 @@ public class ClientItemFindService extends ItemFindService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the instance of the client item find service.
|
||||||
|
*/
|
||||||
public static ClientItemFindService getInstance() {
|
public static ClientItemFindService getInstance() {
|
||||||
return (ClientItemFindService) FindIt.getItemFindService();
|
return (ClientItemFindService) FindIt.getItemFindService();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package com.gtnh.findit.service.itemfinder;
|
package com.gtnh.findit.service.itemfinder;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import com.gtnh.findit.FindIt;
|
import com.gtnh.findit.FindIt;
|
||||||
import com.gtnh.findit.service.blockfinder.BlockFoundResponse;
|
import com.gtnh.findit.service.blockfinder.BlockFoundResponse;
|
||||||
import com.gtnh.findit.util.ProtoUtils;
|
import com.gtnh.findit.util.ProtoUtils;
|
||||||
|
import com.gtnh.findit.util.mods.ForestryUtils;
|
||||||
|
|
||||||
import codechicken.nei.recipe.StackInfo;
|
import codechicken.nei.recipe.StackInfo;
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
@@ -60,6 +63,25 @@ public class FindItemRequest implements IMessage {
|
|||||||
return targetFluidStack.isFluidEqual(StackInfo.getFluid(stack));
|
return targetFluidStack.isFluidEqual(StackInfo.getFluid(stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Additionally check for backpacks that might contain the item itself.
|
||||||
|
if (FindIt.isForestryLoaded()) {
|
||||||
|
Optional<Boolean> result = ForestryUtils.getInventoryOfPotentialStorageItem(stack).map(inventory -> {
|
||||||
|
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||||
|
// This does a recursive call, but backpacks cannot store other backpacks, so we won't run into
|
||||||
|
// StackOverflowExceptions.
|
||||||
|
if (inventory.getStackInSlot(i) != null && isStackSatisfies(inventory.getStackInSlot(i))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// None of the inventory slots contained the item we were looking for.
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
if (result.isPresent()) {
|
||||||
|
return result.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return StackInfo.equalItemAndNBT(targetStack, stack, true);
|
return StackInfo.equalItemAndNBT(targetStack, stack, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
|||||||
import net.minecraftforge.fluids.IFluidHandler;
|
import net.minecraftforge.fluids.IFluidHandler;
|
||||||
import net.minecraftforge.fluids.IFluidTank;
|
import net.minecraftforge.fluids.IFluidTank;
|
||||||
|
|
||||||
|
import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
|
||||||
import com.gtnh.findit.FindIt;
|
import com.gtnh.findit.FindIt;
|
||||||
import com.gtnh.findit.FindItConfig;
|
import com.gtnh.findit.FindItConfig;
|
||||||
import com.gtnh.findit.FindItNetwork;
|
import com.gtnh.findit.FindItNetwork;
|
||||||
@@ -65,6 +66,12 @@ public class ItemFindService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FindIt.isDraconicEvolutionLoaded()) {
|
||||||
|
if (tileEntity instanceof TilePlacedItem placedItem && request.isStackSatisfies(placedItem.getStack())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (request.hasFluidStack()) {
|
if (request.hasFluidStack()) {
|
||||||
if (tileEntity instanceof IFluidTank && request.isFluidSatisfies(((IFluidTank) tileEntity).getFluid())) {
|
if (tileEntity instanceof IFluidTank && request.isFluidSatisfies(((IFluidTank) tileEntity).getFluid())) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.gtnh.findit.util.mods;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import forestry.storage.inventory.ItemInventoryBackpack;
|
||||||
|
import forestry.storage.items.ItemBackpack;
|
||||||
|
|
||||||
|
public class ForestryUtils {
|
||||||
|
|
||||||
|
private ForestryUtils() {}
|
||||||
|
|
||||||
|
public static Optional<IInventory> getInventoryOfPotentialStorageItem(ItemStack potentialBackpackItemStack) {
|
||||||
|
// Checks for Forestry backpacks.
|
||||||
|
Item item = potentialBackpackItemStack.getItem();
|
||||||
|
if (item instanceof ItemBackpack) {
|
||||||
|
ItemBackpack backpack = (ItemBackpack) item;
|
||||||
|
|
||||||
|
// We're running the GUI code client-side only, thus the only player interacting with the GUI is the
|
||||||
|
// player that the backpack's inventory is checked against.
|
||||||
|
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||||
|
|
||||||
|
ItemInventoryBackpack inventory = new ItemInventoryBackpack(
|
||||||
|
player,
|
||||||
|
backpack.getBackpackSize(),
|
||||||
|
potentialBackpackItemStack);
|
||||||
|
return Optional.of(inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user