diff --git a/.github/workflows/head.yml b/.github/workflows/head.yml index 1ff9faa..b6102e5 100644 --- a/.github/workflows/head.yml +++ b/.github/workflows/head.yml @@ -29,7 +29,7 @@ jobs: ./setup.sh - run: | chmod +x ./gradlew - ./gradlew build + ./gradlew build --max-workers=1 env: MOD_VERSION: ${{ steps.vars.outputs.git_hash }} - uses: actions/upload-artifact@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dd1f0cf..2e690ce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: ./setup.sh - run: | chmod +x ./gradlew - ./gradlew build publish curseforge modrinth + ./gradlew build publish curseforge modrinth --max-workers=1 env: MOD_VERSION: ${{ steps.vars.outputs.version }} GITHUB_TOKEN: ${{ github.token }} diff --git a/build.gradle.kts b/build.gradle.kts index e3d0b1b..311672d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -164,6 +164,7 @@ afterEvaluate { optional.project(mrIds.extraGen) optional.project(mrIds.kibe) optional.project(mrIds.modernDynamics) + optional.project(mrIds.powah) } } @@ -196,6 +197,7 @@ afterEvaluate { // addOptional(cfSlugs.lba) addOptional(cfSlugs.luggage) addOptional(cfSlugs.modernDynamics) + addOptional(cfSlugs.powah) addOptional(cfSlugs.rebornCore) addOptional(cfSlugs.techReborn) addOptional(cfSlugs.wirelessNet) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 2e9fab5..632f933 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -11,7 +11,7 @@ repositories { } dependencies { - implementation("fabric-loom:fabric-loom.gradle.plugin:1.0.+") + implementation("fabric-loom:fabric-loom.gradle.plugin:1.1.+") implementation("com.modrinth.minotaur:Minotaur:2.2.1") implementation("com.github.deirn:CurseForgeGradle:c693018f92") implementation("com.google.code.gson:gson:2.9.1") diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 4f63a38..522bb84 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -26,6 +26,7 @@ object deps { val noIndium = "me.luligabi:NoIndium:1.1.0+1.19" val owo = "io.wispforest:owo-lib:0.7.3+1.19" val patchouli = "vazkii.patchouli:Patchouli:1.19.2-76-FABRIC" + val powah = "maven.modrinth:KZO4S4DO:3.0.7-fabric" val dmlSim = "curse.maven:cursemod-508931:3785658" val indrev = "curse.maven:cursemod-391708:3940035" @@ -47,6 +48,8 @@ object deps { val stepAttr = "com.github.emilyploszaj:step-height-entity-attribute:v1.0.1" val fakePlayer = "dev.cafeteria:fake-player-api:0.5.0" val mixinExtras = "com.github.LlamaLad7:MixinExtras:0.1.1-rc.4" + val portingLib = "io.github.fabricators_of_create:Porting-Lib:1.2.783-beta+1.18.2" + val registrate = "com.tterrag.registrate_fabric:Registrate:MC1.18.2-1.1.10" } fun DependencyHandlerScope.modImpl(dep: String, dependencyConfiguration: ExternalModuleDependency.() -> Unit = {}) { diff --git a/buildSrc/src/main/kotlin/FetchLatestVersionsTask.kt b/buildSrc/src/main/kotlin/FetchLatestVersionsTask.kt index 745c50f..caa277e 100644 --- a/buildSrc/src/main/kotlin/FetchLatestVersionsTask.kt +++ b/buildSrc/src/main/kotlin/FetchLatestVersionsTask.kt @@ -45,6 +45,7 @@ abstract class FetchLatestVersionsTask : DefaultTask() { fetch(deps::ae2, mrIds.ae2, "1.19.1") { "appeng:appliedenergistics2-fabric:${it.version_number.removePrefix("fabric-")}" } fetch(deps::alloyForge, mrIds.alloyForge, "1.19") { it.maven } + fetch(deps::architectury, mrIds.architectury) { "dev.architectury:architectury-fabric:${it.version_number.removeSuffix("+fabric")}" } fetch(deps::create, mrIds.create, "1.18.2") { "com.simibubi.create:create-fabric-${ it.version_number.removePrefix("create-fabric-").replaceFirst('-', ':') @@ -60,6 +61,7 @@ abstract class FetchLatestVersionsTask : DefaultTask() { fetch(deps::noIndium, mrIds.noIndium, "1.19") { "me.luligabi:NoIndium:${it.version_number}" } fetch(deps::owo, mrIds.owo, "1.19") { "io.wispforest:owo-lib:${it.version_number}" } fetch(deps::patchouli, mrIds.patchouli) { "vazkii.patchouli:Patchouli:${it.version_number.toUpperCase(Locale.ROOT)}" } + fetch(deps::powah, mrIds.powah) { it.maven } } out() diff --git a/buildSrc/src/main/kotlin/Uploads.kt b/buildSrc/src/main/kotlin/Uploads.kt index 7321eaf..4ef770b 100644 --- a/buildSrc/src/main/kotlin/Uploads.kt +++ b/buildSrc/src/main/kotlin/Uploads.kt @@ -23,6 +23,7 @@ object cfSlugs { val lba = "libblockattributes" val luggage = "luggage" val modernDynamics = "modern-dynamics" + val powah = "powah-rearchitected" val rebornCore = "reborncore" val techReborn = "techreborn" val wirelessNet = "wireless-networks" @@ -34,6 +35,7 @@ object mrIds { val ae2 = "XxWD5pD3" val alloyForge = "jhl28YkY" + val architectury = "lhGA9TYQ" val create = "Xbc0uyRg" val clothConfig = "9s6osm5g" val extraGen = "VXtwLg17" @@ -45,4 +47,5 @@ object mrIds { val noIndium = "Hv40r83o" val owo = "ccKDOlHs" val patchouli = "nU0bVIaL" + val powah = "KZO4S4DO" } diff --git a/conflict.mapping b/conflict.mapping index 113095b..6ce5dfe 100644 --- a/conflict.mapping +++ b/conflict.mapping @@ -1,2 +1,6 @@ CLASS net/minecraft/class_1735 METHOD method_7682 yarn_isEnabled ()Z + +CLASS net/minecraft/class_465 + METHOD method_2389 yarn_drawBackground (Lnet/minecraft/class_4587;FII)V + METHOD method_2388 yarn_drawForeground (Lnet/minecraft/class_4587;II)V diff --git a/gradle.properties b/gradle.properties index 5957d27..1f22954 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -org.gradle.jvmargs = -Xmx2G +org.gradle.jvmargs = -Xmx3G diff --git a/module-compat/create/build.gradle.kts b/module-compat/create/build.gradle.kts index e6b6ed8..f35a7bd 100644 --- a/module-compat/create/build.gradle.kts +++ b/module-compat/create/build.gradle.kts @@ -13,7 +13,11 @@ dependencies { modImpl(deps.create) { exclude("dev.emi:emi") exclude("com.github.LlamaLad7:MixinExtras") + exclude("me.luligabi:NoIndium") } modImpl(deps.fabricApi) modImpl(deps.mixinExtras) + modImpl(deps.noIndium) + modImpl(deps.portingLib) + modImpl(deps.registrate) } diff --git a/module-compat/create/src/main/java/lol/bai/megane/module/create/mixin/MixinCrushingWheelControllerTileEntity.java b/module-compat/create/src/main/java/lol/bai/megane/module/create/mixin/MixinCrushingWheelControllerTileEntity.java index fabdbf6..14dfcd9 100644 --- a/module-compat/create/src/main/java/lol/bai/megane/module/create/mixin/MixinCrushingWheelControllerTileEntity.java +++ b/module-compat/create/src/main/java/lol/bai/megane/module/create/mixin/MixinCrushingWheelControllerTileEntity.java @@ -4,7 +4,6 @@ import com.simibubi.create.content.contraptions.components.crusher.CrushingWheelControllerTileEntity; import com.simibubi.create.content.contraptions.processing.ProcessingRecipe; -import io.github.fabricators_of_create.porting_lib.transfer.item.RecipeWrapper; import lol.bai.megane.module.create.provider.CrushingWheelControllerProgressProvider; import net.minecraft.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; @@ -22,7 +21,7 @@ public abstract class MixinCrushingWheelControllerTileEntity implements Crushing @SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "OptionalIsPresent"}) @Inject(method = "itemInserted", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILHARD) - private void megane_storeRecipeDuration(ItemStack stack, CallbackInfo ci, Optional> recipe) { + private void megane_storeRecipeDuration(ItemStack stack, CallbackInfo ci, Optional> recipe) { recipeDuration = recipe.isPresent() ? recipe.get().getProcessingDuration() : 0; } diff --git a/module-compat/powah/build.gradle.kts b/module-compat/powah/build.gradle.kts new file mode 100644 index 0000000..2c4f092 --- /dev/null +++ b/module-compat/powah/build.gradle.kts @@ -0,0 +1,11 @@ +repositories { + shedaniel() +} + +dependencies { + modImpl(deps.powah) + modImpl(deps.trEnergy) + modImpl(deps.fabricApi) + modImpl(deps.architectury) + modImpl(deps.clothConfig) +} diff --git a/module-compat/powah/src/main/java/lol/bai/megane/module/powah/MeganePowah.java b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/MeganePowah.java new file mode 100644 index 0000000..15f787f --- /dev/null +++ b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/MeganePowah.java @@ -0,0 +1,39 @@ +package lol.bai.megane.module.powah; + +import lol.bai.megane.api.MeganeModule; +import lol.bai.megane.api.registry.ClientRegistrar; +import lol.bai.megane.api.registry.CommonRegistrar; +import lol.bai.megane.module.powah.provider.EnergyEnergyProvider; +import lol.bai.megane.module.powah.provider.FurnatorProgressProvider; +import lol.bai.megane.module.powah.provider.InventoryItemProvider; +import lol.bai.megane.module.powah.provider.ReactorProgressProvider; +import lol.bai.megane.module.powah.provider.TankFluidProvider; +import owmii.powah.block.furnator.FurnatorTile; +import owmii.powah.block.reactor.ReactorPartTile; +import owmii.powah.lib.block.AbstractEnergyStorage; +import owmii.powah.lib.block.IInventoryHolder; +import owmii.powah.lib.block.ITankHolder; + +public class MeganePowah implements MeganeModule { + + @Override + public void registerCommon(CommonRegistrar registrar) { + registrar.addEnergy(AbstractEnergyStorage.class, new EnergyEnergyProvider<>(AbstractEnergyStorage::getEnergy)); + registrar.addEnergy(ReactorPartTile.class, new EnergyEnergyProvider<>(it -> it.core().map(AbstractEnergyStorage::getEnergy).orElse(null))); + + registrar.addItem(IInventoryHolder.class, new InventoryItemProvider<>(IInventoryHolder::getInventory)); + registrar.addItem(ReactorPartTile.class, new InventoryItemProvider<>(it -> it.core().map(IInventoryHolder::getInventory).orElse(null))); + + registrar.addFluid(ITankHolder.class, new TankFluidProvider<>(ITankHolder::getTank)); + registrar.addFluid(ReactorPartTile.class, new TankFluidProvider<>(it -> it.core().map(ITankHolder::getTank).orElse(null))); + + registrar.addProgress(FurnatorTile.class, new FurnatorProgressProvider()); + registrar.addProgress(ReactorPartTile.class, new ReactorProgressProvider()); + } + + @Override + public void registerClient(ClientRegistrar registrar) { + registrar.addEnergyInfo("powah", 0x710C00, "FE"); + } + +} diff --git a/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/EnergyEnergyProvider.java b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/EnergyEnergyProvider.java new file mode 100644 index 0000000..61d43d3 --- /dev/null +++ b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/EnergyEnergyProvider.java @@ -0,0 +1,38 @@ +package lol.bai.megane.module.powah.provider; + +import java.util.function.Function; + +import lol.bai.megane.api.provider.EnergyProvider; +import owmii.powah.lib.logistics.energy.Energy; + +public class EnergyEnergyProvider extends EnergyProvider { + + final Function getter; + + Energy energy; + + public EnergyEnergyProvider(Function getter) { + this.getter = getter; + } + + @Override + protected void init() { + this.energy = getter.apply(getObject()); + } + + @Override + public boolean hasEnergy() { + return energy != null; + } + + @Override + public long getStored() { + return energy.getStored(); + } + + @Override + public long getMax() { + return energy.getMaxEnergyStored(); + } + +} diff --git a/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/FurnatorProgressProvider.java b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/FurnatorProgressProvider.java new file mode 100644 index 0000000..a92bc1d --- /dev/null +++ b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/FurnatorProgressProvider.java @@ -0,0 +1,38 @@ +package lol.bai.megane.module.powah.provider; + +import owmii.powah.block.furnator.FurnatorTile; +import owmii.powah.lib.logistics.inventory.Inventory; +import owmii.powah.lib.util.Ticker; + +public class FurnatorProgressProvider extends TickerProgressProvider { + + static final int[] INPUT = {1}; + static final int[] OUTPUT = {}; + + @Override + protected int[] getInputSlots() { + return INPUT; + } + + @Override + protected int[] getOutputSlots() { + return OUTPUT; + } + + @Override + Ticker getTicker() { + return getObject().getCarbon(); + } + + @Override + Inventory getInventory() { + return getObject().getInventory(); + } + + @Override + public int getPercentage() { + int percent = (int) ticker.perCent(); + return percent == 100 ? 0 : 100 - percent; + } + +} diff --git a/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/InventoryItemProvider.java b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/InventoryItemProvider.java new file mode 100644 index 0000000..869e78b --- /dev/null +++ b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/InventoryItemProvider.java @@ -0,0 +1,40 @@ +package lol.bai.megane.module.powah.provider; + +import java.util.function.Function; + +import lol.bai.megane.api.provider.ItemProvider; +import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.NotNull; +import owmii.powah.lib.logistics.inventory.Inventory; + +public class InventoryItemProvider extends ItemProvider { + + final Function getter; + + Inventory inventory; + + public InventoryItemProvider(Function getter) { + this.getter = getter; + } + + @Override + protected void init() { + this.inventory = getter.apply(getObject()); + } + + @Override + public boolean hasItems() { + return inventory != null; + } + + @Override + public int getSlotCount() { + return inventory.getSlots(); + } + + @Override + public @NotNull ItemStack getStack(int slot) { + return inventory.getStackInSlot(slot); + } + +} diff --git a/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/ReactorProgressProvider.java b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/ReactorProgressProvider.java new file mode 100644 index 0000000..c2c3085 --- /dev/null +++ b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/ReactorProgressProvider.java @@ -0,0 +1,43 @@ +package lol.bai.megane.module.powah.provider; + +import owmii.powah.block.reactor.ReactorPartTile; +import owmii.powah.block.reactor.ReactorTile; +import owmii.powah.lib.logistics.inventory.Inventory; +import owmii.powah.lib.util.Ticker; + +public class ReactorProgressProvider extends TickerProgressProvider { + + ReactorTile core; + + @Override + protected void init() { + this.core = getObject().core().orElse(null); + super.init(); + } + + @Override + protected int[] getInputSlots() { + return new int[0]; + } + + @Override + protected int[] getOutputSlots() { + return new int[0]; + } + + @Override + Ticker getTicker() { + return core.fuel; + } + + @Override + Inventory getInventory() { + return core.getInventory(); + } + + @Override + public int getPercentage() { + return (int) ticker.perCent(); + } + +} diff --git a/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/TankFluidProvider.java b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/TankFluidProvider.java new file mode 100644 index 0000000..b4609f9 --- /dev/null +++ b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/TankFluidProvider.java @@ -0,0 +1,53 @@ +package lol.bai.megane.module.powah.provider; + +import java.util.function.Function; + +import dev.architectury.fluid.FluidStack; +import lol.bai.megane.api.provider.FluidProvider; +import net.minecraft.fluid.Fluid; +import org.jetbrains.annotations.Nullable; +import owmii.powah.lib.logistics.fluid.Tank; + +public class TankFluidProvider extends FluidProvider { + + final Function getter; + + Tank tank; + FluidStack stack; + + public TankFluidProvider(Function getter) { + this.getter = getter; + } + + @Override + protected void init() { + this.tank = getter.apply(getObject()); + } + + @Override + public boolean hasFluids() { + return tank != null; + } + + @Override + public int getSlotCount() { + return tank.getTanks(); + } + + @Override + public @Nullable Fluid getFluid(int slot) { + this.stack = tank.getFluidInTank(slot); + return stack.getFluid(); + } + + @Override + public double getStored(int slot) { + return droplets(stack.getAmount()); + } + + @Override + public double getMax(int slot) { + return droplets(tank.getTankCapacity(slot)); + } + +} diff --git a/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/TickerProgressProvider.java b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/TickerProgressProvider.java new file mode 100644 index 0000000..f7237b0 --- /dev/null +++ b/module-compat/powah/src/main/java/lol/bai/megane/module/powah/provider/TickerProgressProvider.java @@ -0,0 +1,34 @@ +package lol.bai.megane.module.powah.provider; + +import lol.bai.megane.api.provider.base.SlotArrayProgressProvider; +import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.NotNull; +import owmii.powah.lib.logistics.inventory.Inventory; +import owmii.powah.lib.util.Ticker; + +public abstract class TickerProgressProvider extends SlotArrayProgressProvider { + + Ticker ticker; + Inventory inventory; + + abstract Ticker getTicker(); + + abstract Inventory getInventory(); + + @Override + protected void init() { + this.ticker = getTicker(); + this.inventory = getInventory(); + } + + @Override + public boolean hasProgress() { + return ticker != null && inventory != null; + } + + @Override + protected @NotNull ItemStack getStack(int slot) { + return inventory.getStackInSlot(slot); + } + +} diff --git a/module-compat/powah/src/main/resources/fabric.mod.json b/module-compat/powah/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..ddacdc7 --- /dev/null +++ b/module-compat/powah/src/main/resources/fabric.mod.json @@ -0,0 +1,20 @@ +{ + "schemaVersion": 1, + "id" : "megane-powah", + "version" : "${version}", + "authors" : ["deirn"], + "license" : "MIT", + "icon" : "assets/megane/icon.png", + "depends" : { + "megane-api": "*", + "powah" : "*" + }, + "custom" : { + "megane:modules": [ + "lol.bai.megane.module.powah.MeganePowah" + ], + "modmenu" : { + "parent": "megane" + } + } +} diff --git a/module-compat/tech-reborn/src/main/java/lol/bai/megane/module/techreborn/MeganeTechReborn.java b/module-compat/tech-reborn/src/main/java/lol/bai/megane/module/techreborn/MeganeTechReborn.java index 7e6d66a..22b0a12 100644 --- a/module-compat/tech-reborn/src/main/java/lol/bai/megane/module/techreborn/MeganeTechReborn.java +++ b/module-compat/tech-reborn/src/main/java/lol/bai/megane/module/techreborn/MeganeTechReborn.java @@ -12,7 +12,7 @@ import techreborn.blockentity.machine.GenericMachineBlockEntity; import techreborn.blockentity.machine.iron.IronAlloyFurnaceBlockEntity; import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity; -import techreborn.blockentity.machine.multiblock.FusionControlComputerBlockEntity; +import techreborn.blockentity.machine.multiblock.fusion.FusionControlComputerBlockEntity; import techreborn.blockentity.machine.tier1.ElectricFurnaceBlockEntity; import techreborn.blockentity.machine.tier1.RollingMachineBlockEntity; import techreborn.blockentity.machine.tier3.MatterFabricatorBlockEntity; diff --git a/settings.gradle.kts b/settings.gradle.kts index 95e71e7..7888bea 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -25,6 +25,7 @@ compat("kibe") //compat("lib-block-attributes") compat("luggage") compat("modern-dynamics") +compat("powah") compat("reborn-core") compat("reborn-energy") compat("tech-reborn")