diff --git a/build.gradle.kts b/build.gradle.kts index 70ea476a2..4d93835b5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -209,6 +209,9 @@ dependencies { // runtimeOnly("curse.maven:integrated-tunnels-251389:4344632") implementation("mekanism:Mekanism:${mc_version}-${mekanism_version}") + + implementation("curse.maven:iron-chests-228756:5491156") + implementation("curse.maven:iron-shulker-boxes-314911:5491246") } } @@ -268,6 +271,8 @@ minecraft { mixin { config("$mod_id.mixins.json") + config("$mod_id.ironchest.mixins.json") + config("$mod_id.ironshulkerbox.mixins.json") // config("$mod_id.ad_astra.mixins.json") } diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/CopperChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/CopperChestBlockEntityMixin.java new file mode 100644 index 000000000..49af2c026 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/CopperChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.regular.entity.CopperChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(CopperChestBlockEntity.class) +public abstract class CopperChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.copper(containerId, inventory, ((CopperChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/CrystalChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/CrystalChestBlockEntityMixin.java new file mode 100644 index 000000000..fca710c70 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/CrystalChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.regular.entity.CrystalChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(CrystalChestBlockEntity.class) +public abstract class CrystalChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.crystal(containerId, inventory, ((CrystalChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/DiamondChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/DiamondChestBlockEntityMixin.java new file mode 100644 index 000000000..5c9f4dea4 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/DiamondChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.regular.entity.DiamondChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(DiamondChestBlockEntity.class) +public abstract class DiamondChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.diamond(containerId, inventory, ((DiamondChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/DirtChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/DirtChestBlockEntityMixin.java new file mode 100644 index 000000000..e828a851a --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/DirtChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.regular.entity.DirtChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(DirtChestBlockEntity.class) +public abstract class DirtChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.dirt(containerId, inventory, ((DirtChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/GoldChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/GoldChestBlockEntityMixin.java new file mode 100644 index 000000000..f985dbebe --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/GoldChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.regular.entity.GoldChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(GoldChestBlockEntity.class) +public abstract class GoldChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.gold(containerId, inventory, ((GoldChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/IronChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/IronChestBlockEntityMixin.java new file mode 100644 index 000000000..c95ab1dc8 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/IronChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.regular.entity.IronChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(IronChestBlockEntity.class) +public abstract class IronChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.iron(containerId, inventory, ((IronChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/ObsidianChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/ObsidianChestBlockEntityMixin.java new file mode 100644 index 000000000..1e2a45aa6 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/ObsidianChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.regular.entity.ObsidianChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(ObsidianChestBlockEntity.class) +public abstract class ObsidianChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.obsidian(containerId, inventory, ((ObsidianChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedCopperChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedCopperChestBlockEntityMixin.java new file mode 100644 index 000000000..5f3313725 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedCopperChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.trapped.entity.TrappedCopperChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(TrappedCopperChestBlockEntity.class) +public abstract class TrappedCopperChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.copper(containerId, inventory, ((TrappedCopperChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedCrystalChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedCrystalChestBlockEntityMixin.java new file mode 100644 index 000000000..149d6c5a9 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedCrystalChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.trapped.entity.TrappedCrystalChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(TrappedCrystalChestBlockEntity.class) +public abstract class TrappedCrystalChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.crystal(containerId, inventory, ((TrappedCrystalChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedDiamondChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedDiamondChestBlockEntityMixin.java new file mode 100644 index 000000000..0c454f5a7 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedDiamondChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.trapped.entity.TrappedDiamondChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(TrappedDiamondChestBlockEntity.class) +public abstract class TrappedDiamondChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.diamond(containerId, inventory, ((TrappedDiamondChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedDirtChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedDirtChestBlockEntityMixin.java new file mode 100644 index 000000000..5b8c8600b --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedDirtChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.trapped.entity.TrappedDirtChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(TrappedDirtChestBlockEntity.class) +public abstract class TrappedDirtChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.dirt(containerId, inventory, ((TrappedDirtChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedGoldChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedGoldChestBlockEntityMixin.java new file mode 100644 index 000000000..0b52e7787 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedGoldChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.trapped.entity.TrappedGoldChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(TrappedGoldChestBlockEntity.class) +public abstract class TrappedGoldChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.gold(containerId, inventory, ((TrappedGoldChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedIronChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedIronChestBlockEntityMixin.java new file mode 100644 index 000000000..56a5458a7 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedIronChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.trapped.entity.TrappedIronChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(TrappedIronChestBlockEntity.class) +public abstract class TrappedIronChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.iron(containerId, inventory, ((TrappedIronChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedObsidianChestBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedObsidianChestBlockEntityMixin.java new file mode 100644 index 000000000..49efee1f8 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironchest/TrappedObsidianChestBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironchest; + +import com.progwml6.ironchest.common.block.trapped.entity.TrappedObsidianChestBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironchest.MatteryIronChestMenu; + +@Mixin(TrappedObsidianChestBlockEntity.class) +public abstract class TrappedObsidianChestBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronChestMenu.obsidian(containerId, inventory, ((TrappedObsidianChestBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/CopperShulkerBoxBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/CopperShulkerBoxBlockEntityMixin.java new file mode 100644 index 000000000..c99bc8496 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/CopperShulkerBoxBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironshulkerbox; + +import com.progwml6.ironshulkerbox.common.block.entity.CopperShulkerBoxBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironshulkerbox.MatteryIronShulkerBoxMenu; + +@Mixin(CopperShulkerBoxBlockEntity.class) +public abstract class CopperShulkerBoxBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronShulkerBoxMenu.copper(containerId, inventory, ((CopperShulkerBoxBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/CrystalShulkerBoxBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/CrystalShulkerBoxBlockEntityMixin.java new file mode 100644 index 000000000..c2a05b4c3 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/CrystalShulkerBoxBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironshulkerbox; + +import com.progwml6.ironshulkerbox.common.block.entity.CrystalShulkerBoxBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironshulkerbox.MatteryIronShulkerBoxMenu; + +@Mixin(CrystalShulkerBoxBlockEntity.class) +public abstract class CrystalShulkerBoxBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronShulkerBoxMenu.crystal(containerId, inventory, ((CrystalShulkerBoxBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/DiamondShulkerBoxBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/DiamondShulkerBoxBlockEntityMixin.java new file mode 100644 index 000000000..6ed982d9a --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/DiamondShulkerBoxBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironshulkerbox; + +import com.progwml6.ironshulkerbox.common.block.entity.DiamondShulkerBoxBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironshulkerbox.MatteryIronShulkerBoxMenu; + +@Mixin(DiamondShulkerBoxBlockEntity.class) +public abstract class DiamondShulkerBoxBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronShulkerBoxMenu.diamond(containerId, inventory, ((DiamondShulkerBoxBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/GoldShulkerBoxBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/GoldShulkerBoxBlockEntityMixin.java new file mode 100644 index 000000000..4adb75011 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/GoldShulkerBoxBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironshulkerbox; + +import com.progwml6.ironshulkerbox.common.block.entity.GoldShulkerBoxBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironshulkerbox.MatteryIronShulkerBoxMenu; + +@Mixin(GoldShulkerBoxBlockEntity.class) +public abstract class GoldShulkerBoxBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronShulkerBoxMenu.gold(containerId, inventory, ((GoldShulkerBoxBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/IronShulkerBoxBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/IronShulkerBoxBlockEntityMixin.java new file mode 100644 index 000000000..bdd856532 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/IronShulkerBoxBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironshulkerbox; + +import com.progwml6.ironshulkerbox.common.block.entity.IronShulkerBoxBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironshulkerbox.MatteryIronShulkerBoxMenu; + +@Mixin(IronShulkerBoxBlockEntity.class) +public abstract class IronShulkerBoxBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronShulkerBoxMenu.iron(containerId, inventory, ((IronShulkerBoxBlockEntity)(Object) this)); + } +} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/ObsidianShulkerBoxBlockEntityMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/ObsidianShulkerBoxBlockEntityMixin.java new file mode 100644 index 000000000..6a9990a37 --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/ironshulkerbox/ObsidianShulkerBoxBlockEntityMixin.java @@ -0,0 +1,16 @@ +package ru.dbotthepony.mc.otm.mixin.ironshulkerbox; + +import com.progwml6.ironshulkerbox.common.block.entity.ObsidianShulkerBoxBlockEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import ru.dbotthepony.mc.otm.compat.ironshulkerbox.MatteryIronShulkerBoxMenu; + +@Mixin(ObsidianShulkerBoxBlockEntity.class) +public abstract class ObsidianShulkerBoxBlockEntityMixin { + @Overwrite(remap = false) + public AbstractContainerMenu createMenu(int containerId, Inventory inventory) { + return MatteryIronShulkerBoxMenu.obsidian(containerId, inventory, ((ObsidianShulkerBoxBlockEntity)(Object) this)); + } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt index 1f66d1b96..c9fdcaad9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt @@ -44,6 +44,10 @@ import ru.dbotthepony.mc.otm.client.render.blockentity.BatteryBankRenderer import ru.dbotthepony.mc.otm.client.render.blockentity.MatterBatteryBankRenderer import ru.dbotthepony.mc.otm.compat.curios.isCuriosLoaded import ru.dbotthepony.mc.otm.compat.curios.onCuriosSlotModifiersUpdated +import ru.dbotthepony.mc.otm.compat.ironchest.IronChestMenuTypes +import ru.dbotthepony.mc.otm.compat.ironchest.isIronChestLoaded +import ru.dbotthepony.mc.otm.compat.ironshulkerbox.IronShulkersMenuTypes +import ru.dbotthepony.mc.otm.compat.ironshulkerbox.isIronShulkersLoaded import ru.dbotthepony.mc.otm.compat.vanilla.MatteryChestMenu import ru.dbotthepony.mc.otm.compat.vanilla.VanillaMenuTypes import ru.dbotthepony.mc.otm.config.PlayerConfig @@ -134,6 +138,14 @@ object OverdriveThatMatters { StorageStack.register(MOD_BUS) VanillaMenuTypes.register(MOD_BUS) + if (isIronChestLoaded) { + IronChestMenuTypes.register(MOD_BUS) + } + + if (isIronShulkersLoaded) { + IronShulkersMenuTypes.register(MOD_BUS) + } + MCreativeTabs.initialize(MOD_BUS) MOD_BUS.addListener(::registerNetworkPackets) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/ironchest/IronChestMenuTypes.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/ironchest/IronChestMenuTypes.kt new file mode 100644 index 000000000..c7203ff6b --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/ironchest/IronChestMenuTypes.kt @@ -0,0 +1,66 @@ +package ru.dbotthepony.mc.otm.compat.ironchest + +import com.progwml6.ironchest.IronChests +import com.progwml6.ironchest.common.block.IronChestsTypes +import net.minecraft.core.BlockPos +import net.minecraft.core.registries.Registries +import net.minecraft.world.Container +import net.minecraft.world.flag.FeatureFlags +import net.minecraft.world.inventory.MenuType +import net.minecraft.world.level.Level +import net.minecraft.world.level.block.entity.BlockEntity +import net.minecraft.world.level.block.state.BlockState +import net.neoforged.bus.api.IEventBus +import net.neoforged.fml.ModList +import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent +import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent +import ru.dbotthepony.mc.otm.OverdriveThatMatters +import ru.dbotthepony.mc.otm.capability.IQuickStackContainer +import ru.dbotthepony.mc.otm.capability.MatteryCapability +import ru.dbotthepony.mc.otm.compat.vanilla.VanillaChestScreen +import ru.dbotthepony.mc.otm.menu.MatteryMenuSlot +import ru.dbotthepony.mc.otm.menu.makeSlots +import ru.dbotthepony.mc.otm.registry.MDeferredRegister + +val isIronChestLoaded by lazy { + ModList.get().isLoaded(IronChests.MODID) +} + +object IronChestMenuTypes { + private val registrar = MDeferredRegister(Registries.MENU, OverdriveThatMatters.MOD_ID) + + val IRON by registrar.register("ironchest_iron") { MenuType(MatteryIronChestMenu::iron, FeatureFlags.VANILLA_SET) } + val GOLD by registrar.register("ironchest_gold") { MenuType(MatteryIronChestMenu::gold, FeatureFlags.VANILLA_SET) } + val DIAMOND by registrar.register("ironchest_diamond") { MenuType(MatteryIronChestMenu::diamond, FeatureFlags.VANILLA_SET) } + val COPPER by registrar.register("ironchest_copper") { MenuType(MatteryIronChestMenu::copper, FeatureFlags.VANILLA_SET) } + val CRYSTAL by registrar.register("ironchest_crystal") { MenuType(MatteryIronChestMenu::crystal, FeatureFlags.VANILLA_SET) } + val OBSIDIAN by registrar.register("ironchest_obsidian") { MenuType(MatteryIronChestMenu::obsidian, FeatureFlags.VANILLA_SET) } + val DIRT by registrar.register("ironchest_dirt") { MenuType(MatteryIronChestMenu::dirt, FeatureFlags.VANILLA_SET) } + + private fun provider(level: Level, pos: BlockPos, state: BlockState, blockEntity: BlockEntity?, context: Void?): IQuickStackContainer? { + val container = blockEntity as? Container ?: return null + return IQuickStackContainer.Simple(makeSlots(container, ::MatteryMenuSlot)) + } + + fun registerCapabilities(event: RegisterCapabilitiesEvent) { + IronChestsTypes.entries.map { IronChestsTypes.get(it) }.forEach { + event.registerBlock(MatteryCapability.QUICK_STACK_CONTAINER, ::provider, *it.toTypedArray()) + } + } + + internal fun register(bus: IEventBus) { + registrar.register(bus) + bus.addListener(this::registerScreens) + bus.addListener(this::registerCapabilities) + } + + private fun registerScreens(event: RegisterMenuScreensEvent) { + event.register(IRON, ::VanillaChestScreen) + event.register(GOLD, ::VanillaChestScreen) + event.register(DIAMOND, ::VanillaChestScreen) + event.register(COPPER, ::VanillaChestScreen) + event.register(CRYSTAL, ::VanillaChestScreen) + event.register(OBSIDIAN, ::VanillaChestScreen) + event.register(DIRT, ::VanillaChestScreen) + } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/ironchest/MatteryIronChestMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/ironchest/MatteryIronChestMenu.kt new file mode 100644 index 000000000..bd19c9d13 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/ironchest/MatteryIronChestMenu.kt @@ -0,0 +1,82 @@ +package ru.dbotthepony.mc.otm.compat.ironchest + +import com.progwml6.ironchest.common.block.IronChestsTypes +import net.minecraft.world.Container +import net.minecraft.world.SimpleContainer +import net.minecraft.world.entity.player.Inventory +import net.minecraft.world.inventory.MenuType +import net.minecraft.world.item.ItemStack +import net.minecraft.world.item.Items +import ru.dbotthepony.mc.otm.compat.vanilla.AbstractVanillaChestMenu +import ru.dbotthepony.mc.otm.container.EnhancedContainer +import ru.dbotthepony.mc.otm.menu.MatteryMenuSlot +import ru.dbotthepony.mc.otm.menu.QuickMoveInput +import ru.dbotthepony.mc.otm.menu.makeSlots + +class MatteryIronChestMenu( + type: MenuType<*>, containerId: Int, + inventory: Inventory, chestType: IronChestsTypes, + container: Container = EnhancedContainer.Simple(chestType.size), +) : AbstractVanillaChestMenu(type, containerId, inventory, container) { + override val columns = chestType.rowLength + override val rows = chestType.size / chestType.rowLength + + override val containerSlots = if (chestType == IronChestsTypes.DIRT) makeSlots(container, ::MDirtChestSlot) else makeSlots(container, ::MatteryMenuSlot) + + init { + container.startOpen(player) + addStorageSlot(containerSlots) + addInventorySlots() + } + + override val quickMoveToStorage = QuickMoveInput.create(this, playerCombinedInventorySlots, containerSlots) + override val quickMoveFromStorage = QuickMoveInput.create(this, containerSlots, playerInventorySlots, false) + + class MDirtChestSlot(container: Container, slot: Int) : MatteryMenuSlot(container, slot) { + override fun mayPlace(stack: ItemStack): Boolean = stack.isEmpty || stack.`is`(Items.DIRT) + } + + companion object { + @JvmStatic + @JvmOverloads + fun iron(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronChestsTypes.IRON.size), chestType: IronChestsTypes = IronChestsTypes.IRON): MatteryIronChestMenu { + return MatteryIronChestMenu(IronChestMenuTypes.IRON, containerId, inventory, chestType, container) + } + + @JvmStatic + @JvmOverloads + fun gold(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronChestsTypes.GOLD.size), chestType: IronChestsTypes = IronChestsTypes.GOLD): MatteryIronChestMenu { + return MatteryIronChestMenu(IronChestMenuTypes.GOLD, containerId, inventory, chestType, container) + } + + @JvmStatic + @JvmOverloads + fun diamond(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronChestsTypes.DIAMOND.size), chestType: IronChestsTypes = IronChestsTypes.DIAMOND): MatteryIronChestMenu { + return MatteryIronChestMenu(IronChestMenuTypes.DIAMOND, containerId, inventory, chestType, container) + } + + @JvmStatic + @JvmOverloads + fun copper(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronChestsTypes.COPPER.size), chestType: IronChestsTypes = IronChestsTypes.COPPER): MatteryIronChestMenu { + return MatteryIronChestMenu(IronChestMenuTypes.COPPER, containerId, inventory, chestType, container) + } + + @JvmStatic + @JvmOverloads + fun crystal(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronChestsTypes.CRYSTAL.size), chestType: IronChestsTypes = IronChestsTypes.CRYSTAL): MatteryIronChestMenu { + return MatteryIronChestMenu(IronChestMenuTypes.CRYSTAL, containerId, inventory, chestType, container) + } + + @JvmStatic + @JvmOverloads + fun obsidian(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronChestsTypes.OBSIDIAN.size), chestType: IronChestsTypes = IronChestsTypes.OBSIDIAN): MatteryIronChestMenu { + return MatteryIronChestMenu(IronChestMenuTypes.OBSIDIAN, containerId, inventory, chestType, container) + } + + @JvmStatic + @JvmOverloads + fun dirt(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronChestsTypes.DIRT.size), chestType: IronChestsTypes = IronChestsTypes.DIRT): MatteryIronChestMenu { + return MatteryIronChestMenu(IronChestMenuTypes.DIRT, containerId, inventory, chestType, container) + } + } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/ironshulkerbox/IronShulkersMenuTypes.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/ironshulkerbox/IronShulkersMenuTypes.kt new file mode 100644 index 000000000..ad49080e7 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/ironshulkerbox/IronShulkersMenuTypes.kt @@ -0,0 +1,68 @@ +package ru.dbotthepony.mc.otm.compat.ironshulkerbox + +import com.progwml6.ironshulkerbox.IronShulkerBoxes +import com.progwml6.ironshulkerbox.common.block.IronShulkerBoxesTypes +import net.minecraft.core.BlockPos +import net.minecraft.core.registries.Registries +import net.minecraft.world.Container +import net.minecraft.world.flag.FeatureFlags +import net.minecraft.world.inventory.MenuType +import net.minecraft.world.item.DyeColor +import net.minecraft.world.level.Level +import net.minecraft.world.level.block.entity.BlockEntity +import net.minecraft.world.level.block.state.BlockState +import net.neoforged.bus.api.IEventBus +import net.neoforged.fml.ModList +import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent +import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent +import ru.dbotthepony.mc.otm.OverdriveThatMatters +import ru.dbotthepony.mc.otm.capability.IQuickStackContainer +import ru.dbotthepony.mc.otm.capability.MatteryCapability +import ru.dbotthepony.mc.otm.compat.ironshulkerbox.MatteryIronShulkerBoxMenu.Slot +import ru.dbotthepony.mc.otm.compat.vanilla.VanillaChestScreen +import ru.dbotthepony.mc.otm.menu.makeSlots +import ru.dbotthepony.mc.otm.registry.MDeferredRegister +import kotlin.collections.toTypedArray + +val isIronShulkersLoaded by lazy { + ModList.get().isLoaded(IronShulkerBoxes.MODID) +} + +object IronShulkersMenuTypes { + private val registrar = MDeferredRegister(Registries.MENU, OverdriveThatMatters.MOD_ID) + + val IRON by registrar.register("ironshulkerbox_iron") { MenuType(MatteryIronShulkerBoxMenu::iron, FeatureFlags.VANILLA_SET) } + val GOLD by registrar.register("ironshulkerbox_gold") { MenuType(MatteryIronShulkerBoxMenu::gold, FeatureFlags.VANILLA_SET) } + val DIAMOND by registrar.register("ironshulkerbox_diamond") { MenuType(MatteryIronShulkerBoxMenu::diamond, FeatureFlags.VANILLA_SET) } + val COPPER by registrar.register("ironshulkerbox_copper") { MenuType(MatteryIronShulkerBoxMenu::copper, FeatureFlags.VANILLA_SET) } + val CRYSTAL by registrar.register("ironshulkerbox_crystal") { MenuType(MatteryIronShulkerBoxMenu::crystal, FeatureFlags.VANILLA_SET) } + val OBSIDIAN by registrar.register("ironshulkerbox_obsidian") { MenuType(MatteryIronShulkerBoxMenu::obsidian, FeatureFlags.VANILLA_SET) } + + private fun provider(level: Level, pos: BlockPos, state: BlockState, blockEntity: BlockEntity?, context: Void?): IQuickStackContainer? { + val container = blockEntity as? Container ?: return null + return IQuickStackContainer.Simple(makeSlots(container, ::Slot)) + } + + fun registerCapabilities(event: RegisterCapabilitiesEvent) { + val colors = DyeColor.entries.toMutableList().also { it.add(0, null) } + + IronShulkerBoxesTypes.entries.forEach { type -> + event.registerBlock(MatteryCapability.QUICK_STACK_CONTAINER, ::provider, *colors.map { IronShulkerBoxesTypes.get(type, it) }.toTypedArray()) + } + } + + internal fun register(bus: IEventBus) { + registrar.register(bus) + bus.addListener(this::registerScreens) + bus.addListener(this::registerCapabilities) + } + + private fun registerScreens(event: RegisterMenuScreensEvent) { + event.register(IRON, ::VanillaChestScreen) + event.register(GOLD, ::VanillaChestScreen) + event.register(DIAMOND, ::VanillaChestScreen) + event.register(COPPER, ::VanillaChestScreen) + event.register(CRYSTAL, ::VanillaChestScreen) + event.register(OBSIDIAN, ::VanillaChestScreen) + } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/ironshulkerbox/MatteryIronShulkerBoxMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/ironshulkerbox/MatteryIronShulkerBoxMenu.kt new file mode 100644 index 000000000..2f0d6e13e --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/ironshulkerbox/MatteryIronShulkerBoxMenu.kt @@ -0,0 +1,77 @@ +package ru.dbotthepony.mc.otm.compat.ironshulkerbox + +import com.progwml6.ironshulkerbox.common.block.IronShulkerBoxesTypes +import net.minecraft.world.Container +import net.minecraft.world.SimpleContainer +import net.minecraft.world.entity.player.Inventory +import net.minecraft.world.inventory.MenuType +import net.minecraft.world.item.ItemStack +import ru.dbotthepony.mc.otm.compat.vanilla.AbstractVanillaChestMenu +import ru.dbotthepony.mc.otm.container.EnhancedContainer +import ru.dbotthepony.mc.otm.menu.MatteryMenuSlot +import ru.dbotthepony.mc.otm.menu.QuickMoveInput +import ru.dbotthepony.mc.otm.menu.makeSlots + +class MatteryIronShulkerBoxMenu( + type: MenuType<*>, containerId: Int, + inventory: Inventory, boxType: IronShulkerBoxesTypes, + container: Container = EnhancedContainer.Simple(boxType.size) +) : AbstractVanillaChestMenu(type, containerId, inventory, container) { + override val rows: Int = boxType.size / boxType.rowLength + override val columns: Int = boxType.rowLength + + override val containerSlots = makeSlots(container, ::Slot) + + init { + container.startOpen(player) + addStorageSlot(containerSlots) + addInventorySlots() + } + + override val quickMoveToStorage = QuickMoveInput.create(this, playerCombinedInventorySlots, containerSlots) + override val quickMoveFromStorage = QuickMoveInput.create(this, containerSlots, playerInventorySlots, false) + + class Slot(container: Container, slot: Int) : MatteryMenuSlot(container, slot) { + override fun mayPlace(stack: ItemStack): Boolean { + return super.mayPlace(stack) && stack.item.canFitInsideContainerItems() + } + } + + companion object { + @JvmStatic + @JvmOverloads + fun iron(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronShulkerBoxesTypes.IRON.size), boxType: IronShulkerBoxesTypes = IronShulkerBoxesTypes.IRON): MatteryIronShulkerBoxMenu { + return MatteryIronShulkerBoxMenu(IronShulkersMenuTypes.IRON, containerId, inventory, boxType, container) + } + + @JvmStatic + @JvmOverloads + fun gold(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronShulkerBoxesTypes.GOLD.size), boxType: IronShulkerBoxesTypes = IronShulkerBoxesTypes.GOLD): MatteryIronShulkerBoxMenu { + return MatteryIronShulkerBoxMenu(IronShulkersMenuTypes.GOLD, containerId, inventory, boxType, container) + } + + @JvmStatic + @JvmOverloads + fun diamond(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronShulkerBoxesTypes.DIAMOND.size), boxType: IronShulkerBoxesTypes = IronShulkerBoxesTypes.DIAMOND): MatteryIronShulkerBoxMenu { + return MatteryIronShulkerBoxMenu(IronShulkersMenuTypes.DIAMOND, containerId, inventory, boxType, container) + } + + @JvmStatic + @JvmOverloads + fun copper(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronShulkerBoxesTypes.COPPER.size), boxType: IronShulkerBoxesTypes = IronShulkerBoxesTypes.COPPER): MatteryIronShulkerBoxMenu { + return MatteryIronShulkerBoxMenu(IronShulkersMenuTypes.COPPER, containerId, inventory, boxType, container) + } + + @JvmStatic + @JvmOverloads + fun crystal(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronShulkerBoxesTypes.CRYSTAL.size), boxType: IronShulkerBoxesTypes = IronShulkerBoxesTypes.CRYSTAL): MatteryIronShulkerBoxMenu { + return MatteryIronShulkerBoxMenu(IronShulkersMenuTypes.CRYSTAL, containerId, inventory, boxType, container) + } + + @JvmStatic + @JvmOverloads + fun obsidian(containerId: Int, inventory: Inventory, container: Container = SimpleContainer(IronShulkerBoxesTypes.OBSIDIAN.size), boxType: IronShulkerBoxesTypes = IronShulkerBoxesTypes.OBSIDIAN): MatteryIronShulkerBoxMenu { + return MatteryIronShulkerBoxMenu(IronShulkersMenuTypes.OBSIDIAN, containerId, inventory, boxType, container) + } + } +} diff --git a/src/main/resources/META-INF/coremods.json b/src/main/resources/META-INF/coremods.json index 677dde2cf..715af5a6c 100644 --- a/src/main/resources/META-INF/coremods.json +++ b/src/main/resources/META-INF/coremods.json @@ -1,5 +1,6 @@ { "code_injector": "coremods/code_injector.js", "chest_menus": "coremods/chest_menus.js", - "limb_brush_overclock": "coremods/limb_brush_overclock.js" + "limb_brush_overclock": "coremods/limb_brush_overclock.js", + "iron_chest_menus": "coremods/iron_chest_menus.js" } \ No newline at end of file diff --git a/src/main/resources/coremods/iron_chest_menus.js b/src/main/resources/coremods/iron_chest_menus.js new file mode 100644 index 000000000..192b72f69 --- /dev/null +++ b/src/main/resources/coremods/iron_chest_menus.js @@ -0,0 +1,45 @@ + +var Opcodes = Java.type('org.objectweb.asm.Opcodes') +var MethodNode = Java.type('org.objectweb.asm.tree.MethodNode') +var VarInsnNode = Java.type('org.objectweb.asm.tree.VarInsnNode') +var MethodInsnNode = Java.type('org.objectweb.asm.tree.MethodInsnNode') +var InsnNode = Java.type('org.objectweb.asm.tree.InsnNode') +var TypeInsnNode = Java.type('org.objectweb.asm.tree.TypeInsnNode') + + +var isOwnPatches = [ + 'com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity$1', +] + +function initializeCoreMod() { + var result = {} + + for (i in isOwnPatches) { + var clazz = isOwnPatches[i] + + result[clazz] = { + 'target': { + 'type': 'METHOD', + 'class': clazz, + 'methodName': 'isOwnContainer', + 'methodDesc': '(Lnet/minecraft/world/entity/player/Player;)Z' + }, + 'transformer': function(node) { + for (var i = 0; i < node.instructions.size(); i++) { + var instr = node.instructions.get(i) + + if ((instr.getOpcode() == Opcodes.INSTANCEOF || instr.getOpcode() == Opcodes.CHECKCAST) && instr.desc == 'com/progwml6/ironchest/common/inventory/IronChestMenu') { + instr.desc = 'ru/dbotthepony/mc/otm/compat/ironchest/MatteryIronChestMenu' + } else if (instr.getOpcode() == Opcodes.INVOKEVIRTUAL && instr.owner == 'com/progwml6/ironchest/common/inventory/IronChestMenu' && instr.name == 'getContainer') { + instr.owner = 'ru/dbotthepony/mc/otm/compat/ironchest/MatteryIronChestMenu' + instr.name = 'getContainer' + } + } + + return node + } + } + } + + return result +} diff --git a/src/main/resources/overdrive_that_matters.ironchest.mixins.json b/src/main/resources/overdrive_that_matters.ironchest.mixins.json new file mode 100644 index 000000000..20cb09454 --- /dev/null +++ b/src/main/resources/overdrive_that_matters.ironchest.mixins.json @@ -0,0 +1,22 @@ +{ + "required": false, + "package": "ru.dbotthepony.mc.otm.mixin.ironchest", + "compatibilityLevel": "JAVA_21", + "minVersion": "0.8", + "mixins": [ + "IronChestBlockEntityMixin", + "GoldChestBlockEntityMixin", + "DiamondChestBlockEntityMixin", + "CopperChestBlockEntityMixin", + "CrystalChestBlockEntityMixin", + "ObsidianChestBlockEntityMixin", + "DirtChestBlockEntityMixin", + "TrappedIronChestBlockEntityMixin", + "TrappedGoldChestBlockEntityMixin", + "TrappedDiamondChestBlockEntityMixin", + "TrappedCopperChestBlockEntityMixin", + "TrappedCrystalChestBlockEntityMixin", + "TrappedObsidianChestBlockEntityMixin", + "TrappedDirtChestBlockEntityMixin" + ] +} diff --git a/src/main/resources/overdrive_that_matters.ironshulkerbox.mixins.json b/src/main/resources/overdrive_that_matters.ironshulkerbox.mixins.json new file mode 100644 index 000000000..12d348dc5 --- /dev/null +++ b/src/main/resources/overdrive_that_matters.ironshulkerbox.mixins.json @@ -0,0 +1,14 @@ +{ + "required": false, + "package": "ru.dbotthepony.mc.otm.mixin.ironshulkerbox", + "compatibilityLevel": "JAVA_21", + "minVersion": "0.8", + "mixins": [ + "IronShulkerBoxBlockEntityMixin", + "GoldShulkerBoxBlockEntityMixin", + "DiamondShulkerBoxBlockEntityMixin", + "CopperShulkerBoxBlockEntityMixin", + "CrystalShulkerBoxBlockEntityMixin", + "ObsidianShulkerBoxBlockEntityMixin" + ] +}