Browse Source

Add JEI integration to block combination GUI

Signed-off-by: Coded <coded@hrznstudio.com>
alpha
Coded 10 months ago
parent
commit
8fc5ae7da5

+ 10
- 0
build.gradle View File

@@ -22,7 +22,17 @@ version = "${mod_version}"
group = "com.gildedgames"
archivesBaseName = "orbis"


repositories {
mavenCentral()
maven {
url "http://dvs1.progwml6.com/files/maven"
}
}

dependencies {
deobfProvided "mezz.jei:jei_1.12.2:4.14.4.257:api"
runtime "mezz.jei:jei_1.12.2:4.14.4.257"
compile project(":OrbisAPI")
}


+ 15
- 0
src/main/java/com/gildedgames/orbis/client/gui/fill/GuiCombineMatrix.java View File

@@ -187,4 +187,19 @@ public class GuiCombineMatrix extends GuiViewer
Minecraft.getMinecraft().displayGuiScreen(new GuiInventory(this.mc.player));
}
}

public GuiAbstractButton getForgeButton()
{
return forgeButton;
}

public GuiTexture getMatrix()
{
return matrix;
}

public GuiTexture getFlow()
{
return flow;
}
}

+ 52
- 0
src/main/java/com/gildedgames/orbis/common/compat/OrbisJEIPlugin.java View File

@@ -0,0 +1,52 @@
package com.gildedgames.orbis.common.compat;

import com.gildedgames.orbis.client.gui.fill.GuiCombineMatrix;
import com.gildedgames.orbis_api.client.gui.util.GuiAbstractButton;
import com.gildedgames.orbis_api.client.gui.util.GuiTexture;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.JEIPlugin;
import mezz.jei.api.gui.IAdvancedGuiHandler;

import javax.annotation.Nullable;
import java.awt.*;
import java.util.Collections;
import java.util.List;

@JEIPlugin
public class OrbisJEIPlugin implements IModPlugin
{
@Override
public void register(IModRegistry registry)
{
registry.addAdvancedGuiHandlers(new IAdvancedGuiHandler<GuiCombineMatrix>()
{
@Override
public Class<GuiCombineMatrix> getGuiContainerClass()
{
return GuiCombineMatrix.class;
}

@Nullable
@Override
public List<Rectangle> getGuiExtraAreas(GuiCombineMatrix guiContainer)
{
GuiTexture matrix = guiContainer.getMatrix();
GuiTexture flow = guiContainer.getFlow();
GuiAbstractButton forge = guiContainer.getForgeButton();
return Collections.singletonList(
new Rectangle(
(int) matrix.state().dim().x(),
(int) matrix.state().dim().y(),
(int) matrix.state().dim().width(),
(int) (
matrix.state().dim().height() +
flow.state().dim().height() +
forge.state().dim().height()
)
)
);
}
});
}
}

Loading…
Cancel
Save