diff --git a/.gitignore b/.gitignore index 2c770e09..f5f9913a 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ build # other eclipse run + +.shelf +logs diff --git a/bansoukou/gregtech-1.12.2-1.17.1.770/gregtech/api/gui/ModularUI.class b/bansoukou/gregtech-1.12.2-1.17.1.770/gregtech/api/gui/ModularUI.class new file mode 100644 index 00000000..a1025e49 Binary files /dev/null and b/bansoukou/gregtech-1.12.2-1.17.1.770/gregtech/api/gui/ModularUI.class differ diff --git a/bansoukou/gregtech-1.12.2-1.17.1.770/gregtech/api/gui/impl/ModularUIContainer.class b/bansoukou/gregtech-1.12.2-1.17.1.770/gregtech/api/gui/impl/ModularUIContainer.class new file mode 100644 index 00000000..81b7bd3b Binary files /dev/null and b/bansoukou/gregtech-1.12.2-1.17.1.770/gregtech/api/gui/impl/ModularUIContainer.class differ diff --git a/bansoukou/gregtech-1.12.2-1.17.1.770/gregtech/api/gui/widgets/SortableSlotWidget.class b/bansoukou/gregtech-1.12.2-1.17.1.770/gregtech/api/gui/widgets/SortableSlotWidget.class new file mode 100644 index 00000000..49c84084 Binary files /dev/null and b/bansoukou/gregtech-1.12.2-1.17.1.770/gregtech/api/gui/widgets/SortableSlotWidget.class differ diff --git a/bansoukou/gregtech-1.12.2-1.17.1.770/gregtech/common/metatileentities/storage/MetaTileEntityChest.class b/bansoukou/gregtech-1.12.2-1.17.1.770/gregtech/common/metatileentities/storage/MetaTileEntityChest.class new file mode 100644 index 00000000..64862a35 Binary files /dev/null and b/bansoukou/gregtech-1.12.2-1.17.1.770/gregtech/common/metatileentities/storage/MetaTileEntityChest.class differ diff --git a/build.gradle b/build.gradle index 5baeea5c..e79b9d96 100644 --- a/build.gradle +++ b/build.gradle @@ -88,7 +88,7 @@ dependencies { provided 'curse.maven:ae2_extended_life-570458:3811277' provided 'curse.maven:ender_io-64578:3328811' provided 'curse.maven:draconic_evolution-223565:3431261' - provided 'curse.maven:gregtechce-293327:3478805' + provided 'curse.maven:gregtech_ce_unofficial-557242:3859788' provided 'curse.maven:future_mc-310059:3842790' } diff --git a/src/main/java/com/cleanroommc/bogosorter/LateMixin.java b/src/main/java/com/cleanroommc/bogosorter/LateMixin.java index ad9cf92b..5a63bc96 100644 --- a/src/main/java/com/cleanroommc/bogosorter/LateMixin.java +++ b/src/main/java/com/cleanroommc/bogosorter/LateMixin.java @@ -9,7 +9,7 @@ public class LateMixin implements ILateMixinLoader { - public static final List modMixins = ImmutableList.of("ironchest", "thermalexpansion", "enderio", "gregtechce"); + public static final List modMixins = ImmutableList.of("ironchest", "thermalexpansion", "enderio", "gregtechceu"); @Override public List getMixinConfigs() { @@ -23,8 +23,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig) { } public boolean shouldEnableModMixin(String mod) { - if ("gregtechce".equals(mod)) { - return BogoSorter.isGTCELoaded(); + if ("gregtechceu".equals(mod)) { + return BogoSorter.isGTCEuLoaded(); } return Loader.isModLoaded(mod); } diff --git a/src/main/java/com/cleanroommc/bogosorter/common/sort/DefaultRules.java b/src/main/java/com/cleanroommc/bogosorter/common/sort/DefaultRules.java index ae0096e9..09e8ebcd 100644 --- a/src/main/java/com/cleanroommc/bogosorter/common/sort/DefaultRules.java +++ b/src/main/java/com/cleanroommc/bogosorter/common/sort/DefaultRules.java @@ -1,5 +1,6 @@ package com.cleanroommc.bogosorter.common.sort; +import com.cleanroommc.bogosorter.BogoSorter; import com.cleanroommc.bogosorter.api.IBogoSortAPI; import com.cleanroommc.bogosorter.api.SortType; import net.minecraft.nbt.NBTBase; @@ -29,6 +30,7 @@ public static void init(IBogoSortAPI api) { api.registerNbtSortingRule("enchantment_book", "StoredEnchantments", Constants.NBT.TAG_LIST, ItemCompareHelper::compareEnchantments, nbtBase -> (NBTTagList) nbtBase); if (Loader.isModLoaded("gregtech")) { api.registerNbtSortingRule("gt_circ_config", "Configuration", Constants.NBT.TAG_INT); + api.registerNbtSortingRule("gt_item_damage", "GT.ToolStats/Dmg", Constants.NBT.TAG_INT); } } diff --git a/src/main/java/com/cleanroommc/bogosorter/mixin/gtce/MixinChest.java b/src/main/java/com/cleanroommc/bogosorter/mixin/gtce/MixinChest.java deleted file mode 100644 index 081da183..00000000 --- a/src/main/java/com/cleanroommc/bogosorter/mixin/gtce/MixinChest.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.cleanroommc.bogosorter.mixin.gtce; - -import com.cleanroommc.bogosorter.compat.gtce.IModularSortable; -import com.cleanroommc.bogosorter.compat.gtce.SortableSlotWidget; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; -import gregtech.common.metatileentities.storage.MetaTileEntityChest; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.items.ItemStackHandler; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; - -@Mixin(value = MetaTileEntityChest.class, remap = false) -public abstract class MixinChest { - - @Shadow - @Final - private int rowSize; - - @Shadow - @Final - private int amountOfRows; - - @Shadow - private ItemStackHandler inventory; - - @Shadow - protected abstract void onContainerOpen(EntityPlayer player); - - @Shadow - protected abstract void onContainerClose(EntityPlayer player); - - public MetaTileEntityChest getChest() { - return (MetaTileEntityChest) (Object) this; - } - - /** - * @author brachy84 - */ - @Overwrite - public ModularUI createUI(EntityPlayer entityPlayer) { - ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, Math.max(176, 14 + rowSize * 18), 18 + 18 * amountOfRows + 94).label(5, 5, getChest().getMetaFullName()); - - int y; - for (y = 0; y < this.amountOfRows; ++y) { - for (int x = 0; x < this.rowSize; ++x) { - int index = y * this.rowSize + x; - builder.widget(new SortableSlotWidget(inventory, index, 7 + x * 18, 18 + y * 18) - .setSortArea("chest") - .setBackgroundTexture(GuiTextures.SLOT)); - } - } - - y = (Math.max(176, 14 + this.rowSize * 18) - 162) / 2; - builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, y, 18 + 18 * this.amountOfRows + 12); - if (!getChest().getWorld().isRemote) { - builder.bindOpenListener(() -> { - onContainerOpen(entityPlayer); - }); - builder.bindCloseListener(() -> { - onContainerClose(entityPlayer); - }); - } - - ModularUI modularUI = builder.build(getChest().getHolder(), entityPlayer); - ((IModularSortable) (Object) modularUI).addSortArea("chest", rowSize); - return modularUI; - } -} diff --git a/src/main/java/com/cleanroommc/bogosorter/mixin/gtce/MixinModularUI.java b/src/main/java/com/cleanroommc/bogosorter/mixin/gtce/MixinModularUI.java deleted file mode 100644 index 454ffd19..00000000 --- a/src/main/java/com/cleanroommc/bogosorter/mixin/gtce/MixinModularUI.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.cleanroommc.bogosorter.mixin.gtce; - -import com.cleanroommc.bogosorter.compat.gtce.IModularSortable; -import gregtech.api.gui.ModularUI; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; - -import java.util.HashMap; -import java.util.Map; - -@Mixin(ModularUI.class) -public class MixinModularUI implements IModularSortable { - - @Unique - @Final - private final Map sortAreas = new HashMap<>(); - - @Override - public void addSortArea(String key, int rowSize) { - sortAreas.put(key, rowSize); - } - - @Override - public int getRowSize(String key) { - return sortAreas.get(key); - } -} diff --git a/src/main/java/com/cleanroommc/bogosorter/mixin/gtce/MixinModularUIContainer.java b/src/main/java/com/cleanroommc/bogosorter/mixin/gtce/MixinModularUIContainer.java deleted file mode 100644 index f70b514d..00000000 --- a/src/main/java/com/cleanroommc/bogosorter/mixin/gtce/MixinModularUIContainer.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.cleanroommc.bogosorter.mixin.gtce; - -import com.cleanroommc.bogosorter.api.ISortableContainer; -import com.cleanroommc.bogosorter.api.ISortingContextBuilder; -import com.cleanroommc.bogosorter.compat.gtce.IModularSortable; -import com.cleanroommc.bogosorter.compat.gtce.SortableSlotWidget; -import gregtech.api.gui.ModularUI; -import gregtech.api.gui.Widget; -import gregtech.api.gui.impl.ModularUIContainer; -import net.minecraft.inventory.Slot; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Mixin(ModularUIContainer.class) -public class MixinModularUIContainer implements ISortableContainer { - - @Shadow - @Final - private ModularUI modularUI; - - @Override - public void buildSortingContext(ISortingContextBuilder builder) { - Map> sortableSlots = new HashMap<>(); - for (Widget widget : modularUI.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 = getSortableModularUI().getRowSize(entry.getKey()); - if (rowSize > 0) { - builder.addSlotGroup(rowSize, entry.getValue()); - } - } - } - - public IModularSortable getSortableModularUI() { - return (IModularSortable) (Object) modularUI; - } -} diff --git a/src/main/resources/mixin.bogosorter.gregtechce.json b/src/main/resources/mixin.bogosorter.gregtechceu.json similarity index 55% rename from src/main/resources/mixin.bogosorter.gregtechce.json rename to src/main/resources/mixin.bogosorter.gregtechceu.json index e14f5094..7254f5f8 100644 --- a/src/main/resources/mixin.bogosorter.gregtechce.json +++ b/src/main/resources/mixin.bogosorter.gregtechceu.json @@ -1,12 +1,9 @@ { - "package": "com.cleanroommc.bogosorter.mixin.gtce", + "package": "com.cleanroommc.bogosorter.mixin.gtceu", "refmap": "mixins.bogosorter.refmap.json", "target": "@env(DEFAULT)", "minVersion": "0.8", "compatibilityLevel": "JAVA_8", "mixins": [ - "MixinChest", - "MixinModularUI", - "MixinModularUIContainer" ] } \ No newline at end of file