mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Set up element bounds and hidden items in JEI, also merged in fixed GUIs
This commit is contained in:
commit
2f61ea103f
9 files changed
+54
-4
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package mekanism.client.gui.element;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.ObfuscatedNames;
|
||||
@@ -13,8 +14,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class GuiElement
|
||||
{
|
||||
@@ -145,6 +144,7 @@ public abstract class GuiElement
|
||||
public static class Rectangle4i
|
||||
{
|
||||
public int x, y, width, height;
|
||||
|
||||
public Rectangle4i(int x, int y, int width, int height)
|
||||
{
|
||||
this.x = x;
|
||||
@@ -152,5 +152,10 @@ public abstract class GuiElement
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Rectangle toRectangle()
|
||||
{
|
||||
return new Rectangle(x, y, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package mekanism.client.jei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.element.GuiElement;
|
||||
import mezz.jei.api.gui.IAdvancedGuiHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
public class GuiElementHandler implements IAdvancedGuiHandler
|
||||
{
|
||||
@Override
|
||||
public Class getGuiContainerClass()
|
||||
{
|
||||
return GuiMekanism.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getGuiExtraAreas(GuiContainer gui)
|
||||
{
|
||||
if(gui instanceof GuiMekanism)
|
||||
{
|
||||
List<Rectangle> list = new ArrayList<Rectangle>();
|
||||
|
||||
GuiMekanism guiMek = (GuiMekanism)gui;
|
||||
|
||||
for(GuiElement element : guiMek.guiElements)
|
||||
{
|
||||
list.add(element.getBounds(guiMek.getXPos(), guiMek.getYPos()).toRectangle());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package mekanism.client.jei;
|
||||
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.MekanismItems;
|
||||
import mezz.jei.api.IItemRegistry;
|
||||
import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.IJeiRuntime;
|
||||
@@ -7,6 +9,7 @@ import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.IRecipeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@JEIPlugin
|
||||
public class MekanismJEI implements IModPlugin
|
||||
@@ -14,7 +17,10 @@ public class MekanismJEI implements IModPlugin
|
||||
@Override
|
||||
public void register(IModRegistry registry)
|
||||
{
|
||||
registry.addAdvancedGuiHandlers(new GuiElementHandler());
|
||||
|
||||
registry.getJeiHelpers().getItemBlacklist().addItemToBlacklist(new ItemStack(MekanismItems.ItemProxy));
|
||||
registry.getJeiHelpers().getItemBlacklist().addItemToBlacklist(new ItemStack(MekanismBlocks.BoundingBlock));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -26,7 +32,7 @@ public class MekanismJEI implements IModPlugin
|
||||
@Override
|
||||
public void onJeiHelpersAvailable(IJeiHelpers helpers)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -161,7 +161,7 @@ import com.mojang.authlib.GameProfile;
|
||||
*
|
||||
*/
|
||||
@Mod(modid = "Mekanism", name = "Mekanism", version = "9.0.0", guiFactory = "mekanism.client.gui.ConfigGuiFactory",
|
||||
dependencies = "after:ForgeMultipart;after:BuildCraft;after:BuildCraftAPI;after:IC2;after:CoFHCore;" +
|
||||
dependencies = "after:JEI;after:BuildCraft;after:BuildCraftAPI;after:IC2;after:CoFHCore;" +
|
||||
"after:ComputerCraft;after:Galacticraft API;after:MetallurgyCore")
|
||||
public class Mekanism
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user