mirror of
https://github.com/GTNewHorizons/FindIt.git
synced 2026-11-18 23:59:05 +00:00
Remove hard-dependency on GregTech (#10)
* Update buildscript * Make GregTech a soft-dependency * Small cleanup
This commit is contained in:
1 parent
f31f2e3adf
commit
f6eb09de3a
13 files changed
+451
-87
No files matched your search
@@ -8,7 +8,6 @@ import com.gtnh.findit.service.itemfinder.ItemFindService;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@@ -16,19 +15,21 @@ import cpw.mods.fml.relauncher.Side;
|
||||
modid = FindIt.MOD_ID,
|
||||
name = FindIt.MOD_NAME,
|
||||
version = FindIt.VERSION,
|
||||
dependencies = "required-after:NotEnoughItems;required-after:gregtech",
|
||||
acceptableRemoteVersions = "*")
|
||||
dependencies = "required-after:NotEnoughItems;after:gregtech",
|
||||
acceptableRemoteVersions = "*",
|
||||
acceptedMinecraftVersions = "[1.7.10]")
|
||||
public class FindIt {
|
||||
|
||||
// Mod info
|
||||
public static final String MOD_ID = "GRADLETOKEN_MODID";
|
||||
public static final String MOD_NAME = "GRADLETOKEN_MODNAME";
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
public static final String MOD_ID = "findit";
|
||||
public static final String MOD_NAME = "FindIt";
|
||||
public static final String VERSION = Tags.VERSION;
|
||||
|
||||
@Mod.Instance(MOD_ID)
|
||||
public static FindIt INSTANCE;
|
||||
|
||||
private boolean extraUtilitiesLoaded;
|
||||
private boolean gregTechloaded;
|
||||
|
||||
private SearchCooldownService cooldownService;
|
||||
private BlockFindService blockFindService;
|
||||
@@ -36,18 +37,16 @@ public class FindIt {
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
extraUtilitiesLoaded = Loader.isModLoaded("ExtraUtilities");
|
||||
this.extraUtilitiesLoaded = Loader.isModLoaded("ExtraUtilities");
|
||||
this.gregTechloaded = Loader.isModLoaded("gregtech");
|
||||
FindItConfig.setup(event.getSuggestedConfigurationFile());
|
||||
boolean isClient = event.getSide() == Side.CLIENT;
|
||||
|
||||
cooldownService = new SearchCooldownService();
|
||||
blockFindService = isClient ? new ClientBlockFindService() : new BlockFindService();
|
||||
itemFindService = isClient ? new ClientItemFindService() : new ItemFindService();
|
||||
this.cooldownService = new SearchCooldownService();
|
||||
this.blockFindService = isClient ? new ClientBlockFindService() : new BlockFindService();
|
||||
this.itemFindService = isClient ? new ClientItemFindService() : new ItemFindService();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {}
|
||||
|
||||
public static SearchCooldownService getCooldownService() {
|
||||
return INSTANCE.cooldownService;
|
||||
}
|
||||
@@ -63,4 +62,8 @@ public class FindIt {
|
||||
public static boolean isExtraUtilitiesLoaded() {
|
||||
return INSTANCE.extraUtilitiesLoaded;
|
||||
}
|
||||
|
||||
public static boolean isGregTechLoaded() {
|
||||
return INSTANCE.gregTechloaded;
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public class BlockFindService {
|
||||
}
|
||||
|
||||
int tileMeta;
|
||||
if (tileEntity instanceof IGregTechTileEntity) {
|
||||
if (FindIt.isGregTechLoaded() && tileEntity instanceof IGregTechTileEntity) {
|
||||
tileMeta = ((IGregTechTileEntity) tileEntity).getMetaTileID();
|
||||
} else {
|
||||
tileMeta = tileEntity.getBlockMetadata();
|
||||
|
||||
@@ -132,6 +132,7 @@ public class ClientItemFindService extends ItemFindService {
|
||||
public void updateHighlightedSlots(GuiContainer gui) {
|
||||
highlightedSlots.clear();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Slot> slots = (List<Slot>) gui.inventorySlots.inventorySlots;
|
||||
Item targetItem = targetStack.getItem();
|
||||
int targetMeta = targetStack.getItemDamage();
|
||||
|
||||
@@ -101,6 +101,7 @@ public class ItemFindService {
|
||||
return;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Slot> slots = (List<Slot>) container.inventorySlots;
|
||||
List<Integer> targetSlots = new ArrayList<>();
|
||||
Set<ChunkPosition> tilePositions = new HashSet<>();
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.gtnh.findit.util;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.client.gui.implementations.*;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
@@ -21,9 +20,7 @@ public abstract class AbstractStackFinder implements IContainerInputHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyTyped(GuiContainer guiContainer, char c, int i) {
|
||||
|
||||
}
|
||||
public void onKeyTyped(GuiContainer guiContainer, char c, int i) {}
|
||||
|
||||
@Override
|
||||
public boolean lastKeyTyped(GuiContainer guiContainer, char c, int i) {
|
||||
@@ -49,14 +46,10 @@ public abstract class AbstractStackFinder implements IContainerInputHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(GuiContainer guiContainer, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
public void onMouseClicked(GuiContainer guiContainer, int i, int i1, int i2) {}
|
||||
|
||||
@Override
|
||||
public void onMouseUp(GuiContainer guiContainer, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
public void onMouseUp(GuiContainer guiContainer, int i, int i1, int i2) {}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer guiContainer, int i, int i1, int i2) {
|
||||
@@ -64,12 +57,8 @@ public abstract class AbstractStackFinder implements IContainerInputHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseScrolled(GuiContainer guiContainer, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
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) {
|
||||
|
||||
}
|
||||
public void onMouseDragged(GuiContainer guiContainer, int i, int i1, int i2, long l) {}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ public class WorldUtils {
|
||||
for (int cz = z1 >> 4; cz <= cz1; cz++) {
|
||||
Chunk chunk = world.getChunkFromChunkCoords(cx, cz);
|
||||
if (chunk != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<ChunkPosition, TileEntity> tiles = chunk.chunkTileEntityMap;
|
||||
for (TileEntity tile : tiles.values()) {
|
||||
if (!tile.isInvalid() && tile.xCoord >= x1
|
||||
|
||||
Reference in new issue
Block a user