Skip to content

Commit

Permalink
disable jei animation when hei ingredient buffer render is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
brachy84 committed Jul 19, 2024
1 parent 2c6e45a commit 92bae95
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
3 changes: 3 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
* For more details, see https://docs.gradle.org/8.4/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
runtimeOnlyNonPublishable rfg.deobf('curse.maven:top-245211:2667280') // TOP 1.4.28
devOnlyNonPublishable rfg.deobf("curse.maven:had_enough_items-557549:5471944")

devOnlyNonPublishable rfg.deobf("curse.maven:mouse_tweaks_unofficial-461660:4661407")
devOnlyNonPublishable rfg.deobf("curse.maven:trashslot-235577:2722385")
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ includeWellKnownRepositories = true
# Adds JEI and TheOneProbe to your development environment. Adds them as 'implementation', meaning they will
# be available at compiletime and runtime for your mod (in-game and in-code).
# Overrides the above setting to be always true, as these repositories are needed to fetch the mods
includeCommonDevEnvMods = true
includeCommonDevEnvMods = false

# Some mods require a specific forge version to launch in. When you need to use one of those mods as a dependency,
# and cannot launch with the forge version required, enable this to strip the forge version requirements from that mod.
Expand Down
27 changes: 23 additions & 4 deletions src/main/java/com/cleanroommc/neverenoughanimations/NEA.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
Expand All @@ -29,18 +30,27 @@

import java.awt.*;

@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME,
acceptedMinecraftVersions = "[1.12.2]", clientSideOnly = true, dependencies = "required:mixinbooter@[8.8,);")
@Mod(modid = Tags.MODID,
version = Tags.VERSION,
name = Tags.MODNAME,
acceptedMinecraftVersions = "[1.12.2]",
clientSideOnly = true,
dependencies = "required:mixinbooter@[8.8,);")
public class NEA {

public static final Logger LOGGER = LogManager.getLogger(Tags.MODID);
public static boolean itemBordersLoaded = false;
private static boolean itemBordersLoaded = false, jeiLoaded = false, heiLoaded = false;
private static int mouseX, mouseY;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(this);
itemBordersLoaded = Loader.isModLoaded("itemborders");
jeiLoaded = Loader.isModLoaded("jei");
if (jeiLoaded) {
ModContainer mod = Loader.instance().getIndexedModList().get("jei");
heiLoaded = "Had Enough Items".equals(mod.getName());
}
}

@SubscribeEvent
Expand Down Expand Up @@ -117,7 +127,8 @@ public static void drawScreenDebug(GuiContainer container, int mouseX, int mouse
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
container.drawString(fr, "Mouse Pos: " + mouseX + ", " + mouseY, 5, lineY, color);
lineY -= 11;
container.drawString(fr, "Rel. Mouse Pos: " + (mouseX - container.getGuiLeft()) + ", " + (mouseY - container.getGuiTop()), 5, lineY, color);
container.drawString(fr, "Rel. Mouse Pos: " + (mouseX - container.getGuiLeft()) + ", " + (mouseY - container.getGuiTop()), 5, lineY,
color);
IItemLocation slot = IItemLocation.of(container.getSlotUnderMouse());
if (slot != null) {
lineY -= 11;
Expand All @@ -141,4 +152,12 @@ public static void drawScreenDebug(GuiContainer container, int mouseX, int mouse
public static boolean isItemBordersLoaded() {
return itemBordersLoaded;
}

public static boolean isJeiLoaded() {
return jeiLoaded;
}

public static boolean isHeiLoaded() {
return heiLoaded;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.cleanroommc.neverenoughanimations.core.mixin.jei;

import com.cleanroommc.neverenoughanimations.NEA;
import com.cleanroommc.neverenoughanimations.animations.OpeningAnimation;
import mezz.jei.api.gui.IGuiProperties;
import mezz.jei.config.Config;
import mezz.jei.gui.overlay.IngredientListOverlay;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
Expand All @@ -27,7 +29,7 @@ public class IngredientListOverlayMixin {

@Inject(method = "drawScreen", at = @At("HEAD"))
public void drawScreenPre(Minecraft minecraft, int mouseX, int mouseY, float partialTicks, CallbackInfo ci) {
if (guiProperties != null) {
if (guiProperties != null && (!NEA.isHeiLoaded() || !Config.bufferIngredientRenders())) {
GlStateManager.pushMatrix();
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
if (screen instanceof GuiContainer container) {
Expand All @@ -40,7 +42,7 @@ public void drawScreenPre(Minecraft minecraft, int mouseX, int mouseY, float par

@Inject(method = "drawScreen", at = @At("TAIL"))
public void drawScreenPost(Minecraft minecraft, int mouseX, int mouseY, float partialTicks, CallbackInfo ci) {
if (guiProperties != null) {
if (guiProperties != null && (!NEA.isHeiLoaded() || !Config.bufferIngredientRenders())) {
GlStateManager.popMatrix();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.cleanroommc.neverenoughanimations.core.mixin.jei;

import com.cleanroommc.neverenoughanimations.NEA;
import com.cleanroommc.neverenoughanimations.animations.OpeningAnimation;
import mezz.jei.config.Config;
import mezz.jei.gui.overlay.bookmarks.LeftAreaDispatcher;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
Expand All @@ -25,7 +27,7 @@ public abstract class LeftAreaDispatcherMixin {

@Inject(method = "drawScreen", at = @At("HEAD"))
public void drawScreenPre(Minecraft minecraft, int mouseX, int mouseY, float partialTicks, CallbackInfo ci) {
if (canShow && hasContent()) {
if (canShow && hasContent() && (!NEA.isHeiLoaded() || !Config.bufferIngredientRenders())) {
GlStateManager.pushMatrix();
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
if (screen instanceof GuiContainer container) {
Expand All @@ -38,7 +40,7 @@ public void drawScreenPre(Minecraft minecraft, int mouseX, int mouseY, float par

@Inject(method = "drawScreen", at = @At("TAIL"))
public void drawScreenPost(Minecraft minecraft, int mouseX, int mouseY, float partialTicks, CallbackInfo ci) {
if (canShow && hasContent()) {
if (canShow && hasContent() && (!NEA.isHeiLoaded() || !Config.bufferIngredientRenders())) {
GlStateManager.popMatrix();
}
}
Expand Down

0 comments on commit 92bae95

Please sign in to comment.