Skip to content

Commit

Permalink
Modular GUI Implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon3055 committed Jan 10, 2024
1 parent b4954cf commit 228be19
Show file tree
Hide file tree
Showing 78 changed files with 13,098 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ configurations {
repositories {
mavenLocal()
maven { url "https://maven.covers1624.net/" }
maven { url "https://dvs1.progwml6.com/files/maven/" }
}

dependencies {
Expand All @@ -81,6 +82,9 @@ dependencies {

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'

compileOnly(fg.deobf("mezz.jei:jei-${config.mc_version}-common-api:${config.jei_version}"))
compileOnly(fg.deobf("mezz.jei:jei-${config.mc_version}-forge-api:${config.jei_version}"))
}

test {
Expand Down
37 changes: 37 additions & 0 deletions src/main/java/codechicken/lib/compat/JEIPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package codechicken.lib.compat;

import codechicken.lib.CodeChickenLib;
import codechicken.lib.gui.modular.ModularGuiContainer;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
import mezz.jei.api.gui.handlers.IGuiContainerHandler;
import mezz.jei.api.registration.IGuiHandlerRegistration;
import net.minecraft.client.renderer.Rect2i;
import net.minecraft.resources.ResourceLocation;

import java.util.List;

/**
* Created by brandon3055 on 31/12/2023
*/
@JeiPlugin
public class JEIPlugin implements IModPlugin {
private static final ResourceLocation ID = new ResourceLocation(CodeChickenLib.MOD_ID, "jei_plugin");

public JEIPlugin() {}

@Override
public ResourceLocation getPluginUid() {
return ID;
}

@Override
public void registerGuiHandlers(IGuiHandlerRegistration registration) {
registration.addGuiContainerHandler(ModularGuiContainer.class, new IGuiContainerHandler<>() {
@Override
public List<Rect2i> getGuiExtraAreas(ModularGuiContainer screen) {
return screen.getModularGui().getJeiExclusions().map(e -> e.getRectangle().toRect2i()).toList();
}
});
}
}
Loading

0 comments on commit 228be19

Please sign in to comment.