Implement extra area for schematic table
This commit is contained in:
parent
8281c5746a
commit
a534d2230c
3 changed files with 17 additions and 6 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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<T extends Container> implements IGuiContainerHandler<AbstractSimiContainerScreen<T>> {
|
||||
public class SlotMover implements IGuiContainerHandler<AbstractSimiContainerScreen<?>> {
|
||||
|
||||
@Override
|
||||
public List<Rectangle2d> getGuiExtraAreas(AbstractSimiContainerScreen<T> containerScreen) {
|
||||
public List<Rectangle2d> getGuiExtraAreas(AbstractSimiContainerScreen<?> containerScreen) {
|
||||
return containerScreen.getExtraAreas();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<SchematicT
|
|||
private IconButton folderButton;
|
||||
private IconButton refreshButton;
|
||||
private Label schematicsLabel;
|
||||
private List<Rectangle2d> 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<SchematicT
|
|||
widgets.add(confirmButton);
|
||||
widgets.add(folderButton);
|
||||
widgets.add(refreshButton);
|
||||
|
||||
extraAreas = new ArrayList<>();
|
||||
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<SchematicT
|
|||
return super.mouseClicked(p_mouseClicked_1_, p_mouseClicked_3_, p_mouseClicked_5_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Rectangle2d> getExtraAreas() {
|
||||
return extraAreas;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue