mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-19 19:49:41 +00:00
Move JEI items out of the way of GuiMultiModule modules
This commit is contained in:
1 parent
eeccb45b16
commit
e2e08b93d8
5 files changed
+71
-1
No files matched your search
@@ -6,6 +6,7 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -39,6 +40,10 @@ public abstract class GuiModule extends GuiContainer {
|
||||
return guiTop + ySize;
|
||||
}
|
||||
|
||||
public Rectangle getArea() {
|
||||
return new Rectangle(guiLeft, guiTop, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
|
||||
@@ -14,8 +14,10 @@ import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -57,6 +59,14 @@ public class GuiMultiModule extends GuiContainer { //implements INEIGuiHandler {
|
||||
modules.add(module);
|
||||
}
|
||||
|
||||
public List<Rectangle> getModuleAreas() {
|
||||
List<Rectangle> areas = new ArrayList<>(modules.size());
|
||||
for (GuiModule module : modules) {
|
||||
areas.add(module.getArea());
|
||||
}
|
||||
return areas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
if(realWidth > -1) {
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package slimeknights.mantle.util;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import mezz.jei.api.IItemRegistry;
|
||||
import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.IJeiRuntime;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.IRecipeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import mezz.jei.api.gui.IAdvancedGuiHandler;
|
||||
import slimeknights.mantle.client.gui.GuiMultiModule;
|
||||
|
||||
@JEIPlugin
|
||||
public class JeiPlugin implements IModPlugin {
|
||||
@Override
|
||||
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers) {}
|
||||
|
||||
@Override
|
||||
public void onItemRegistryAvailable(IItemRegistry itemRegistry) {}
|
||||
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
registry.addAdvancedGuiHandlers(new IAdvancedGuiHandler<GuiMultiModule>() {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<GuiMultiModule> getGuiContainerClass() {
|
||||
return GuiMultiModule.class;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<Rectangle> getGuiExtraAreas(@Nonnull GuiMultiModule guiContainer) {
|
||||
return guiContainer.getModuleAreas();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry) {}
|
||||
|
||||
@Override
|
||||
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {}
|
||||
}
|
||||
Reference in new issue
Block a user