From a534d2230c5160fdef615ba1d69a7775c428480a Mon Sep 17 00:00:00 2001 From: Snownee Date: Tue, 16 Mar 2021 00:26:00 +0800 Subject: [PATCH] Implement extra area for schematic table --- .../com/simibubi/create/compat/jei/CreateJEI.java | 7 +++++-- .../com/simibubi/create/compat/jei/SlotMover.java | 5 ++--- .../schematics/block/SchematicTableScreen.java | 11 ++++++++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java index de757db48..33606b4da 100644 --- a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java +++ b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java @@ -40,6 +40,7 @@ import com.simibubi.create.content.contraptions.fluids.recipe.PotionMixingRecipe import com.simibubi.create.content.contraptions.processing.BasinRecipe; import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateScreen; import com.simibubi.create.content.logistics.item.filter.AbstractFilterScreen; +import com.simibubi.create.content.schematics.block.SchematicTableScreen; import com.simibubi.create.content.schematics.block.SchematicannonScreen; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.CRecipes; @@ -226,8 +227,10 @@ public class CreateJEI implements IModPlugin { @Override public void registerGuiHandlers(IGuiHandlerRegistration registration) { - registration.addGuiContainerHandler(AdjustableCrateScreen.class, new SlotMover<>()); - registration.addGuiContainerHandler(SchematicannonScreen.class, new SlotMover<>()); + SlotMover slotMover = new SlotMover(); + registration.addGuiContainerHandler(AdjustableCrateScreen.class, slotMover); + registration.addGuiContainerHandler(SchematicannonScreen.class, slotMover); + registration.addGuiContainerHandler(SchematicTableScreen.class, slotMover); registration.addGhostIngredientHandler(AbstractFilterScreen.class, new FilterGhostIngredientHandler()); } diff --git a/src/main/java/com/simibubi/create/compat/jei/SlotMover.java b/src/main/java/com/simibubi/create/compat/jei/SlotMover.java index 3188e3324..427735ca7 100644 --- a/src/main/java/com/simibubi/create/compat/jei/SlotMover.java +++ b/src/main/java/com/simibubi/create/compat/jei/SlotMover.java @@ -6,17 +6,16 @@ import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; import mezz.jei.api.gui.handlers.IGuiContainerHandler; import net.minecraft.client.renderer.Rectangle2d; -import net.minecraft.inventory.container.Container; /** * Allows a {@link AbstractSimiContainerScreen} to specify an area in getExtraArea() that will be avoided by JEI * * Name is taken from CoFHCore's 1.12 implementation. */ -public class SlotMover implements IGuiContainerHandler> { +public class SlotMover implements IGuiContainerHandler> { @Override - public List getGuiExtraAreas(AbstractSimiContainerScreen containerScreen) { + public List getGuiExtraAreas(AbstractSimiContainerScreen containerScreen) { return containerScreen.getExtraAreas(); } } diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java index 9d89dd340..afc1aaaba 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java @@ -4,6 +4,7 @@ import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE; import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE_PROGRESS; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.List; import com.mojang.blaze3d.systems.RenderSystem; @@ -21,6 +22,7 @@ import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; import com.simibubi.create.foundation.utility.Lang; import net.minecraft.client.gui.IHasContainer; +import net.minecraft.client.renderer.Rectangle2d; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.Util; @@ -35,6 +37,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen extraAreas; private final String title = Lang.translate("gui.schematicTable.title"); private final String uploading = Lang.translate("gui.schematicTable.uploading"); @@ -87,12 +90,14 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen(); + extraAreas.add(new Rectangle2d(mainLeft, mainTop, SCHEMATIC_TABLE.width, SCHEMATIC_TABLE.height)); } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY); - } @Override @@ -212,4 +217,8 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen getExtraAreas() { + return extraAreas; + } }