-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e5903b
commit 5628efe
Showing
8 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.gtnewhorizon.gtnhlib; | ||
|
||
import com.gtnewhorizon.gtnhlib.config.Config; | ||
|
||
@Config(modid = GTNHLib.MODID) | ||
public class GTNHLibConfig { | ||
|
||
@Config.Comment("Set to true to no longer check if the NEI version is new enough to support RenderTooltipEvents") | ||
@Config.DefaultBoolean(false) | ||
public static boolean ignoreNEIVersion; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/com/gtnewhorizon/gtnhlib/compat/NotEnoughItemsVersionChecker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.gtnewhorizon.gtnhlib.compat; | ||
|
||
import java.util.Locale; | ||
|
||
import com.gtnewhorizon.gtnhlib.GTNHLib; | ||
import com.gtnewhorizon.gtnhlib.GTNHLibConfig; | ||
|
||
import cpw.mods.fml.client.FMLClientHandler; | ||
import cpw.mods.fml.common.FMLCommonHandler; | ||
import cpw.mods.fml.common.Loader; | ||
import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent; | ||
import cpw.mods.fml.common.versioning.ArtifactVersion; | ||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion; | ||
|
||
public class NotEnoughItemsVersionChecker { | ||
|
||
@SubscribeEvent | ||
public void checkNEIVersion(ClientTickEvent event) { | ||
if (FMLClientHandler.instance().getClient().thePlayer == null) { | ||
return; | ||
} | ||
|
||
FMLCommonHandler.instance().bus().unregister(this); | ||
|
||
if (GTNHLibConfig.ignoreNEIVersion) { | ||
return; | ||
} | ||
|
||
ArtifactVersion neiVersion = Loader.instance().getIndexedModList().get("NotEnoughItems").getProcessedVersion(); | ||
if (neiVersion.compareTo(new DefaultArtifactVersion("2.7.8-GTNH")) >= 0) { | ||
return; // NEI is at least version 2.7.8-GTNH | ||
} | ||
GTNHLib.proxy.addWarnToChat( | ||
String.format( | ||
Locale.ROOT, | ||
"Installed NEI version is to old to support RenderTooltipEvents! This may cause problems. Installed NEI version: %s (2.7.8-GTNH and newer support RenderTooltipEvents)", | ||
neiVersion.getVersionString())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters