From 34648f06876986830530fdfd43de8696ca87645c Mon Sep 17 00:00:00 2001 From: Abdulaziz <127992888+0hwx@users.noreply.github.com> Date: Sat, 11 Jan 2025 11:58:51 +0300 Subject: [PATCH] Compat (#34) Co-authored-by: Martin Robertz --- dependencies.gradle | 10 +- .../bogosorter/compat/DefaultCompat.java | 481 ++++++------------ .../bogosorter/compat/loader/Mods.java | 13 +- .../ironchests/MixinIronShulkerContainer.java | 30 -- 4 files changed, 186 insertions(+), 348 deletions(-) delete mode 100644 src/main/java/com/cleanroommc/bogosorter/mixins/late/ironchests/MixinIronShulkerContainer.java diff --git a/dependencies.gradle b/dependencies.gradle index 5720ace..24b8654 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -45,7 +45,7 @@ dependencies { // used for chunk claim checking compileOnly("com.github.GTNewHorizons:ServerUtilities:2.1.12:dev") -// api("com.github.GTNewHorizons:AdventureBackpack2:1.2.4-GTNH:dev") + compileOnly("com.github.GTNewHorizons:ProjectRed:4.11.0-GTNH:dev") compileOnly("com.github.GTNewHorizons:AdventureBackpack2:1.2.4-GTNH:dev") compileOnly("com.github.GTNewHorizons:Minecraft-Backpack-Mod:2.5.0-GTNH:dev") compileOnly("com.github.GTNewHorizons:Galacticraft:3.3.1-GTNH:dev") @@ -71,4 +71,12 @@ dependencies { compileOnly rfg.deobf('curse.maven:thermal_expansion-69163:2388758') compileOnly rfg.deobf('curse.maven:thermal_foundation-222880:2388752') compileOnly rfg.deobf('curse.maven:cofh_core-69162:2388750') + compileOnly rfg.deobf('curse.maven:et-futurum-requiem-441392:5873837') + compileOnly rfg.deobf('curse.maven:bibliocraft-228027:2423369') + compileOnly rfg.deobf('curse.maven:mekanism-ce-399904:5988091') + compileOnly rfg.deobf('curse.maven:immersive-engineering-231951:2299019') + compileOnly rfg.deobf('curse.maven:the-betweenlands-243363:2317389') + compileOnly rfg.deobf('curse.maven:terrafirmacraft-302973:2627990') + compileOnly rfg.deobf('curse.maven:energy-control-373450:4776055') + compileOnly rfg.deobf('curse.maven:industrial-craft-242638:2353971') } diff --git a/src/main/java/com/cleanroommc/bogosorter/compat/DefaultCompat.java b/src/main/java/com/cleanroommc/bogosorter/compat/DefaultCompat.java index 10e4ed1..53136ca 100644 --- a/src/main/java/com/cleanroommc/bogosorter/compat/DefaultCompat.java +++ b/src/main/java/com/cleanroommc/bogosorter/compat/DefaultCompat.java @@ -2,24 +2,45 @@ import static com.cleanroommc.bogosorter.compat.loader.Mods.*; +import java.util.ArrayList; +import java.util.List; + import net.blay09.mods.cookingforblockheads.container.ContainerCounter; import net.blay09.mods.cookingforblockheads.container.ContainerFridge; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.ContainerDispenser; import net.minecraft.inventory.ContainerHopper; import net.minecraft.inventory.ContainerPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import com.bioxx.tfc.Containers.ContainerChestTFC; import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest; import com.cleanroommc.bogosorter.api.IBogoSortAPI; import com.cleanroommc.bogosorter.api.IPosSetter; import com.cleanroommc.bogosorter.api.ISlot; +import com.zuxelus.energycontrol.containers.ContainerCardHolder; import appeng.container.implementations.ContainerSkyChest; +import blusunrize.immersiveengineering.common.gui.ContainerCrate; import codechicken.enderstorage.storage.item.ContainerEnderItemStorage; -import cpw.mods.fml.common.Loader; import de.eydamos.backpack.inventory.container.ContainerAdvanced; +import forestry.core.gui.ContainerNaturalistInventory; import forestry.storage.gui.ContainerBackpack; +import forestry.storage.gui.ContainerNaturalistBackpack; +import ganymedes01.etfuturum.inventory.ContainerChestGeneric; +import ic2.core.block.personal.ContainerPersonalChest; +import ic2.core.item.tool.ContainerToolbox; +import jds.bibliocraft.blocks.ContainerFramedChest; import micdoodle8.mods.galacticraft.core.inventory.ContainerParaChest; +import moze_intel.projecte.gameObjs.container.AlchBagContainer; +import moze_intel.projecte.gameObjs.container.AlchChestContainer; +import moze_intel.projecte.gameObjs.container.CondenserContainer; +import moze_intel.projecte.gameObjs.container.CondenserMK2Container; +import tconstruct.tools.inventory.CraftingStationContainer; +import tconstruct.tools.inventory.PartCrafterChestContainer; +import tconstruct.tools.inventory.PatternChestContainer; +import thebetweenlands.inventory.container.ContainerLurkerSkinPouch; import wanion.avaritiaddons.block.chest.compressed.ContainerCompressedChest; public class DefaultCompat { @@ -30,7 +51,7 @@ public static void init(IBogoSortAPI api) { // player slots are automatically added }); api.addPlayerSortButtonPosition(ContainerPlayer.class, (slotGroup, buttonPos) -> { - if (Loader.isModLoaded("nutrition")) { + if (Nutrition.isLoaded()) { IPosSetter.TOP_RIGHT_VERTICAL.setButtonPos(slotGroup, buttonPos); } else { IPosSetter.TOP_RIGHT_HORIZONTAL.setButtonPos(slotGroup, buttonPos); @@ -91,32 +112,55 @@ public static void init(IBogoSortAPI api) { (container, builder) -> { builder.addSlotGroup(36, 84, 8); }); } - // if (Loader.isModLoaded("futuremc")) { - // api.addCompatSimple(ContainerBarrel.class, (container, builder) -> { - // builder.addSlotGroup(0, 27, 9); - // }); - // } - // - // if (Loader.isModLoaded("projecte")) { - // api.addCompat(CondenserContainer.class, (container, builder) -> { - // builder.addSlotGroup(1, 92, 13); - // }); - // api.addCompat(CondenserMK2Container.class, (container, builder) -> { - // builder.addSlotGroup(1, 43, 6) - // .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); - // builder.addSlotGroup(43, 85, 6) - // .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); - // }); - // api.addPlayerSortButtonPosition(CondenserContainer.class, IPosSetter.TOP_RIGHT_VERTICAL); - // api.addPlayerSortButtonPosition(CondenserMK2Container.class, IPosSetter.TOP_RIGHT_VERTICAL); - // } - // - // if (Loader.isModLoaded("immersiveengineering")) { - // api.addCompat(ContainerCrate.class, (container, builder) -> { - // builder.addSlotGroup(0, container.slotCount, 9); - // }); - // } - // + if (Etfuturum.isLoaded()) { + api.addCompat( + ContainerChestGeneric.class, + (container, builder) -> { + builder.addSlotGroup( + 0, + container.getLowerChestInventory() + .getSizeInventory(), + container.getRowSize()); + }); + api.addPlayerSortButtonPosition(ContainerChestGeneric.class, (slotGroup, buttonPos) -> { + if (IronChest.isLoaded()) { + IPosSetter.TOP_RIGHT_VERTICAL.setButtonPos(slotGroup, buttonPos); + } else { + IPosSetter.TOP_RIGHT_HORIZONTAL.setButtonPos(slotGroup, buttonPos); + } + }); + } + + if (ProjectE.isLoaded()) { + api.addCompat( + AlchBagContainer.class, + (container, builder) -> { + builder.addSlotGroup(0, 104, 13) + .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); + }); + api.addCompat( + AlchChestContainer.class, + (container, builder) -> { + builder.addSlotGroup(0, 104, 13) + .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); + }); + api.addCompat(CondenserContainer.class, (container, builder) -> { builder.addSlotGroup(1, 92, 13); }); + api.addCompat( + CondenserMK2Container.class, + (container, builder) -> { + builder.addSlotGroup(1, 43, 6) + .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); + }); + api.addPlayerSortButtonPosition(AlchBagContainer.class, IPosSetter.TOP_RIGHT_VERTICAL); + api.addPlayerSortButtonPosition(AlchChestContainer.class, IPosSetter.TOP_RIGHT_VERTICAL); + api.addPlayerSortButtonPosition(CondenserContainer.class, IPosSetter.TOP_RIGHT_VERTICAL); + api.addPlayerSortButtonPosition(CondenserMK2Container.class, IPosSetter.TOP_RIGHT_VERTICAL); + } + + if (ImmersiveEngineering.isLoaded()) { + api.addCompat(ContainerCrate.class, (container, builder) -> { builder.addSlotGroup(0, 27, 9); }); + } + if (Forestry.isLoaded()) { api.addCompat(ContainerBackpack.class, (container, builder) -> { if (container.inventorySlots.size() == 51) { @@ -126,214 +170,76 @@ public static void init(IBogoSortAPI api) { } }); + api.addCompat(ContainerNaturalistBackpack.class, (container, builder) -> { + List slots = new ArrayList<>(); + for (int i = 0; i < 25; i++) { + for (int j = 0; j < 5; j++) { + slots.add(container.getSlot(i * 5 + j + 36)); + } + } + builder.addSlotGroupOf(slots, 5) + .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); + }); + api.addCompat(ContainerNaturalistInventory.class, (container, builder) -> { + List slots = new ArrayList<>(); + for (int i = 0; i < 25; i++) { + for (int j = 0; j < 5; j++) { + slots.add(container.getSlot(i * 5 + j + 36)); + } + } + builder.addSlotGroupOf(slots, 5) + .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); + }); + api.addPlayerSortButtonPosition(ContainerNaturalistBackpack.class, IPosSetter.TOP_RIGHT_VERTICAL); + api.addPlayerSortButtonPosition(ContainerNaturalistInventory.class, IPosSetter.TOP_RIGHT_VERTICAL); + } + + if (IC2.isLoaded()) { + api.addGenericCompat(ContainerPersonalChest.class); + api.addCompat(ContainerToolbox.class, (container, builder) -> { builder.addSlotGroup(0, 9, 9); }); + } + + if (Bibliocraft.isLoaded()) { + api.addCompat( + ContainerFramedChest.class, + (container, builder) -> { + builder.addSlotGroup( + 0, + container.getMainTile() + .getIsDouble() ? 27 * 2 : 27, + 9); + }); + } + + if (Energycontrol.isLoaded()) { + api.addCompat(ContainerCardHolder.class, (container, builder) -> { builder.addSlotGroup(0, 54, 9); }); + } + + if (ProjectRed.isLoaded()) { + api.addCompat( + mrtjp.projectred.exploration.ContainerBackpack.class, + (container, builder) -> { builder.addSlotGroup(0, 27, 9); }); + } + + if (Thebetweenlands.isLoaded()) { + api.addCompat(ContainerLurkerSkinPouch.class, (container, builder) -> { + IInventory inventory = container.inventory; + builder.addSlotGroup(0, inventory.getSizeInventory(), 9); + }); + } + + if (Terrafirmacraft.isLoaded()) { + api.addCompat( + ContainerChestTFC.class, + (container, builder) -> { + builder.addSlotGroup( + 0, + container.getLowerChestInventory() + .getSizeInventory(), + 9); + }); } - // api.addCompat(ContainerNaturalistBackpack.class, (container, builder) -> { - // List slots = new ArrayList<>(); - // for (int i = 0; i < 25; i++) { - // for (int j = 0; j < 5; j++) { - // slots.add(container.getSlot(i * 5 + j + 36)); - // } - // } - // builder.addSlotGroupOf(slots, 5) - // .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); - // }); - // api.addCompat(ContainerNaturalistInventory.class, (container, builder) -> { - // List slots = new ArrayList<>(); - // for (int i = 0; i < 25; i++) { - // for (int j = 0; j < 5; j++) { - // slots.add(container.getSlot(i * 5 + j + 36)); - // } - // } - // builder.addSlotGroupOf(slots, 5) - // .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); - // }); - // api.addPlayerSortButtonPosition(ContainerNaturalistBackpack.class, IPosSetter.TOP_RIGHT_VERTICAL); - // api.addPlayerSortButtonPosition(ContainerNaturalistInventory.class, IPosSetter.TOP_RIGHT_VERTICAL); - // } - // - // if (BogoSorter.isIc2ExpLoaded()) { - // api.addCompat(DynamicContainer.class, (container, builder) -> { - // if (container.base instanceof TileEntityStorageBox) { - // if (container.base instanceof TileEntityWoodenStorageBox) { - // builder.addSlotGroup(0, 27, 9); - // } else if (container.base instanceof TileEntityBronzeStorageBox || container.base instanceof - // TileEntityIronStorageBox) { - // builder.addSlotGroup(0, 45, 9); - // } else if (container.base instanceof TileEntitySteelStorageBox) { - // builder.addSlotGroup(0, 63, 9); - // } else if (container.base instanceof TileEntityIridiumStorageBox) { - // builder.addSlotGroup(0, 126, 18); - // } - // } - // // personal safe client side - // if (container.base instanceof TileEntityPersonalChest) { - // builder.addSlotGroup(0, 54, 9); - // } - // }); - // personal safe server side - // api.addCompatSimple(getClass("ic2.core.block.personal.TileEntityPersonalChest$2"), (container, builder) -> { - // builder.addSlotGroup(0, 54, 9); - // }); - // api.addCompat(ContainerToolbox.class, (container, builder) -> { - // builder.addSlotGroup(0, 9, 9); - // }); - // } - // - // if (BogoSorter.isIc2ClassicLoaded()) { - // api.addCompat(ContainerPersonalChest.class, (container, builder) -> { - // // make sure player can edit this chest - // if (!(container.inventorySlots.get(0) instanceof SlotGhoest)) { - // builder.addSlotGroup(0, 54, 9); - // } - // }); - // api.addCompat(ContainerToolBox.class, (container, builder) -> { - // ToolBoxInventory inv = container.getGuiHolder(); - // if (inv instanceof ToolBoxInventory.IridiumBoxInventory) { - // builder.addSlotGroup(0, 45, 9); - // } else if (inv instanceof ToolBoxInventory.CarbonBoxInventory) { - // builder.addSlotGroup(0, 15, 5) - // .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); - // } else { - // builder.addSlotGroup(0, 8, 4) - // .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); - // } - // }); - // } - // - // if (Loader.isModLoaded("metalchests")) { - // api.addCompat(ContainerMetalChest.class, (container, builder) -> { - // builder.addSlotGroup(0, container.type.getInventorySize(), container.type.getColumns()); - // }); - // } - // - // if (BogoSorter.isGTCEuLoaded()) { - // api.addCompat(ModularUIContainer.class, (container, builder) -> { - // Map> sortableSlots = new Object2ObjectOpenHashMap<>(); - // - // for (Widget widget : container.getModularUI().getFlatVisibleWidgetCollection()) { - // if (widget instanceof SortableSlotWidget) { - // SortableSlotWidget sortableSlotWidget = (SortableSlotWidget) widget; - // if (sortableSlotWidget.getSortArea() != null) { - // sortableSlots.computeIfAbsent(sortableSlotWidget.getSortArea(), (key) -> new - // ArrayList<>()).add(sortableSlotWidget.getHandle()); - // } - // } - // } - // - // for (Map.Entry> entry : sortableSlots.entrySet()) { - // int rowSize = ((IModularSortable) (Object) container.getModularUI()).getRowSize(entry.getKey()); - // if (rowSize > 0) { - // builder.addSlotGroupOf(entry.getValue(), rowSize).buttonPosSetter(null); - // } - // } - // }); - // api.addPlayerSortButtonPosition(ModularUIContainer.class, null); - // } - // - // if (Loader.isModLoaded("travelersbackpack")) { - // api.addCompat(ContainerTravelersBackpack.class, (container, builder) -> { - // List slots = new ArrayList<>(); - // for (int i = 0; i < 3; i++) { - // for (int j = 0; j < 8; j++) { - // slots.add(container.getSlot(i * 8 + j + 10)); - // } - // } - // for (int i = 3; i < 6; i++) { - // for (int j = 0; j < 5; j++) { - // slots.add(container.getSlot((i - 3) * 5 + j + 34)); - // } - // } - // builder.addSlotGroupOf(slots, 8); - // }); - // api.addPlayerSortButtonPosition(ContainerTravelersBackpack.class, (slotGroup, buttonPos) -> { - // ISlot topRight = slotGroup.getSlots().get(slotGroup.getRowSize() - 1); - // buttonPos.setPos(topRight.bogo$getX() + 17, topRight.bogo$getY() - 1); - // }); - // } - // - // if (Loader.isModLoaded("colossalchests")) { - // api.addCompat(ContainerColossalChest.class, (container, builder) -> { - // List chestSlots = ((ContainerColossalChestAccessor) container).getChestSlots(); - // builder.addSlotGroupOf(chestSlots, 9).buttonPosSetter((slotGroup, buttonPos) -> { - // buttonPos.setPos(0, 1000); - // for (ISlot slot : slotGroup.getSlots()) { - // if (slot.bogo$getX() >= 0 && slot.bogo$getY() >= 0 && slot.bogo$isEnabled()) { - // buttonPos.setPos(Math.max(buttonPos.getX(), slot.bogo$getX() + 17), Math.min(buttonPos.getY(), - // slot.bogo$getY() - 2)); - // } - // } - // }); - // }); - // api.addPlayerSortButtonPosition(ContainerColossalChest.class, (slotGroup, buttonPos) -> { - // ISlot slot = slotGroup.getSlots().get(26); - // buttonPos.setPos(slot.bogo$getX() + 19, slot.bogo$getY() - 2); - // buttonPos.setTopLeft(); - // buttonPos.setVertical(); - // }); - // api.addCompat(ContainerUncolossalChest.class, (container, builder) -> { - // builder.addSlotGroup(0, 5, 5); - // }); - // } - // - // if (BogoSorter.isQuarkLoaded()) { - // api.addCompat(vazkii.quark.oddities.inventory.ContainerBackpack.class, (container, builder) -> { - // builder.addSlotGroup(46, 46 + 27, 9) - // .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); - // }); - // api.addPlayerSortButtonPosition(vazkii.quark.oddities.inventory.ContainerBackpack.class, - // IPosSetter.TOP_RIGHT_VERTICAL); - // } - // - // if (Loader.isModLoaded("cyclicmagic")) { - // api.addCompat(ContainerStorage.class, (container, builder) -> { - // builder.addSlotGroup(0, 77, 11); - // }); - // api.addPlayerSortButtonPosition(ContainerStorage.class, (slotGroup, buttonPos) -> { - // ISlot topRight = slotGroup.getSlots().get(26); - // buttonPos.setVertical(); - // buttonPos.setTopLeft(); - // buttonPos.setPos(topRight.bogo$getX() + 18, topRight.bogo$getY() + 3); - // }); - // } - // - // if (Loader.isModLoaded("bibliocraft")) { - // api.addCompat(ContainerFramedChest.class, (container, builder) -> { - // builder.addSlotGroup(0, container.getMainTile().getIsDouble() ? 27 * 2 : 27, 9); - // }); - // } - // - // if (Loader.isModLoaded("railcraft")) { - // api.addCompat(ContainerRCChest.class, (container, builder) -> { - // builder.addSlotGroup(0, container.getInv().getSizeInventory(), 9); - // }); - // } - // - // if (Loader.isModLoaded("energycontrol")) { - // api.addCompat(ContainerCardHolder.class, (container, builder) -> { - // builder.addSlotGroup(0, 54, 9); - // }); - // } - // - // if (Loader.isModLoaded("projectred-exploration")) { - // api.addCompat(mrtjp.projectred.exploration.ContainerBackpack.class, (container, builder) -> { - // builder.addSlotGroup(0, 27, 9); - // }); - // } - // - // if (Loader.isModLoaded("thebetweenlands")) { - // api.addCompat(ContainerPouch.class, (container, builder) -> { - // IInventory inventory = container.getItemInventory(); - // builder.addSlotGroup(0, inventory.getSizeInventory(), 9); - // }); - // } - // - // if (Loader.isModLoaded("tfc")) { - // api.addCompat(ContainerChestTFC.class, (container, builder) -> { - // builder.addSlotGroup(0, container.getLowerChestInventory().getSizeInventory(), 9); - // }); - // } - // if (GalacticraftCore.isLoaded()) { api.addCompat(ContainerParaChest.class, (container, builder) -> { int slot = container.getparachestInventory() @@ -344,26 +250,6 @@ public static void init(IBogoSortAPI api) { } }); } - // - // if (Loader.isModLoaded("rustic")) { - // api.addCompat(ContainerCabinet.class, (container, builder) -> { - // builder.addGenericSlotGroup() - // .buttonPosSetter(BogoSorter.isQuarkLoaded() ? IPosSetter.TOP_RIGHT_VERTICAL : - // IPosSetter.TOP_RIGHT_HORIZONTAL); - // }); - // api.addCompat(ContainerCabinetDouble.class, (container, builder) -> { - // builder.addGenericSlotGroup() - // .buttonPosSetter(BogoSorter.isQuarkLoaded() ? IPosSetter.TOP_RIGHT_VERTICAL : - // IPosSetter.TOP_RIGHT_HORIZONTAL); - // }); - // api.addCompat(rustic.common.tileentity.ContainerBarrel.class, (container, builder) -> - // builder.addGenericSlotGroup() - // .buttonPosSetter(BogoSorter.isQuarkLoaded() ? IPosSetter.TOP_RIGHT_VERTICAL : - // IPosSetter.TOP_RIGHT_HORIZONTAL)); - // api.addCompat(ContainerVase.class, (container, builder) -> builder.addGenericSlotGroup() - // .buttonPosSetter(BogoSorter.isQuarkLoaded() ? IPosSetter.TOP_RIGHT_VERTICAL : - // IPosSetter.TOP_RIGHT_HORIZONTAL)); - // } if (AvaritiaAddons.isLoaded()) { api.addCompatSimple( ContainerCompressedChest.class, @@ -380,71 +266,34 @@ public static void init(IBogoSortAPI api) { // buttonPos.setPos(topRight.bogo$getX() + 17, topRight.bogo$getY() - 1); // }); } - // - // if (BogoSorter.isExpandableInventoryLoaded()) { - // // mark as sortable - // api.addCompat(ContainerExpandedInventory.class, (container, builder) -> { - // }); - // } - // - // if (Loader.isModLoaded("charm")) { - // api.addCompat(svenhjol.charm.crafting.container.ContainerBarrel.class, (container, builder) -> { - // builder.addSlotGroup(0, 27, 9); - // }); - // } - // - // if (Loader.isModLoaded("industrialrenewal")) { - // api.addCompat(ContainerStorageChest.class, (container, builder) -> { - // builder.addGenericSlotGroup().buttonPosSetter((slotGroup, buttonPos) -> { - // buttonPos.setPos(0, 1000); - // for (ISlot slot : slotGroup.getSlots()) { - // if (slot.bogo$getX() >= 0 && slot.bogo$getY() >= 0 && slot.bogo$isEnabled()) { - // buttonPos.setPos(Math.max(buttonPos.getX(), slot.bogo$getX() + 17), Math.min(buttonPos.getY(), - // slot.bogo$getY() - 2)); - // } - // } - // }); - // }); - // api.addPlayerSortButtonPosition(ContainerStorageChest.class, (slotGroup, buttonPos) -> { - // ISlot slot = slotGroup.getSlots().get(26); - // buttonPos.setPos(slot.bogo$getX() + 19, slot.bogo$getY() - 2); - // buttonPos.setTopLeft(); - // buttonPos.setVertical(); - // }); - // } - // + if (CookingForBlockheads.isLoaded()) { api.addGenericCompat(ContainerCounter.class); api.addGenericCompat(ContainerFridge.class); } - // - // if (Loader.isModLoaded("mekanism")) { - // api.addGenericCompat(mekanism.common.inventory.container.ContainerPersonalChest.class); - // } - // - // if (Loader.isModLoaded("conarm")) { - // api.addGenericCompat(ContainerKnapsack.class); + + if (Mekanism.isLoaded()) { + api.addGenericCompat(mekanism.common.inventory.container.ContainerPersonalChest.class); + } + + if (Tconstruct.isLoaded()) { + api.addGenericCompat(PatternChestContainer.class); + api.addCompat(PartCrafterChestContainer.class, (container, builder) -> { builder.addSlotGroup(8, 38, 6); }); + api.addCompat(CraftingStationContainer.class, (container, builder) -> { + if (container.inventorySlots.size() >= 47) { + builder.addSlotGroup(47, container.inventorySlots.size(), 6) + .buttonPosSetter((slotGroup, buttonPos) -> { + buttonPos.setPos(0, 1000); + for (ISlot slot : slotGroup.getSlots()) { + if (slot.bogo$getX() >= 0 && slot.bogo$getY() >= 0 && slot.bogo$isEnabled()) { + buttonPos.setPos( + Math.max(buttonPos.getX(), slot.bogo$getX() + 17), + Math.min(buttonPos.getY(), slot.bogo$getY() - 2)); + } + } + }); + } + }); + } } } - -// private static ISlot avaritiaddons$findSlot(List slots, ItemStack itemStack, boolean emptyOnly) { -// for (ISlot slot : slots) { -// ItemStack stackInSlot = slot.bogo$getStack(); -// if (stackInSlot != null && ItemHandlerHelper.canItemStacksStack(stackInSlot, itemStack)) { -// return emptyOnly ? null : slot; -// } -// } -// for (ISlot slot : slots) { -// if (slot.bogo$getStack()== null) return slot; -// } -// return null; -// } -// -// public static Class getClass1(String name){ -// try { -// return Class.forName(name, false, DefaultCompat.class.getClassLoader()); -// } catch (ClassNotFoundException e) { -// throw new RuntimeException(e); -// } -// } -// } diff --git a/src/main/java/com/cleanroommc/bogosorter/compat/loader/Mods.java b/src/main/java/com/cleanroommc/bogosorter/compat/loader/Mods.java index 3e24e84..f536322 100644 --- a/src/main/java/com/cleanroommc/bogosorter/compat/loader/Mods.java +++ b/src/main/java/com/cleanroommc/bogosorter/compat/loader/Mods.java @@ -19,7 +19,18 @@ public enum Mods { AdventureBackpack2("adventurebackpack"), ProjectE("ProjectE"), Tconstruct("TConstruct"), - ServerUtilities("serverutilities"); + ServerUtilities("serverutilities"), + Nutrition("nutrition"), + Bibliocraft("BiblioCraft"), + Mekanism("Mekanism"), + ProjectRed("ProjRed|Expansion"), + ImmersiveEngineering("ImmersiveEngineering"), + Thebetweenlands("thebetweenlands"), + Terrafirmacraft("terrafirmacraft"), + Energycontrol("energycontrol"), + Etfuturum("etfuturum"), + IronChest("IronChest"), + IC2("IC2"); public final String modid; private final Supplier supplier; diff --git a/src/main/java/com/cleanroommc/bogosorter/mixins/late/ironchests/MixinIronShulkerContainer.java b/src/main/java/com/cleanroommc/bogosorter/mixins/late/ironchests/MixinIronShulkerContainer.java deleted file mode 100644 index e6a6277..0000000 --- a/src/main/java/com/cleanroommc/bogosorter/mixins/late/ironchests/MixinIronShulkerContainer.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.cleanroommc.bogosorter.mixins.late.ironchests;// package - // com.cleanroommc.bogosorter.core.mixin.early.ironchests; - -// -// import com.cleanroommc.bogosorter.api.IPosSetter; -// import com.cleanroommc.bogosorter.api.ISortableContainer; -// import com.cleanroommc.bogosorter.api.ISortingContextBuilder; -// import cpw.mods.ironchest.common.blocks.shulker.IronShulkerBoxType; -// import cpw.mods.ironchest.common.gui.shulker.ContainerIronShulkerBox; -// import org.jetbrains.annotations.Nullable; -// import org.spongepowered.asm.mixin.Mixin; -// import org.spongepowered.asm.mixin.Shadow; -// -// @Mixin(value = ContainerIronShulkerBox.class, remap = false) -// public class MixinIronShulkerContainer implements ISortableContainer { -// -// @Shadow -// private IronShulkerBoxType type; -// -// @Override -// public void buildSortingContext(ISortingContextBuilder builder) { -// builder.addSlotGroup(0, type.size, type.rowLength) -// .buttonPosSetter(IPosSetter.TOP_RIGHT_VERTICAL); -// } -// -// @Override -// public @Nullable IPosSetter getPlayerButtonPosSetter() { -// return IPosSetter.TOP_RIGHT_VERTICAL; -// } -// }