diff --git a/build.gradle b/build.gradle index cbf4d1d..c00715c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'maven-publish' - id 'fabric-loom' version '0.5-SNAPSHOT' apply false + id 'fabric-loom' version '0.6-SNAPSHOT' apply false } def versionEnv = System.getenv("MOD_VERSION") @@ -18,12 +18,7 @@ allprojects { targetCompatibility = 1.8 repositories { - maven { - url "https://jitpack.io" - content { - includeGroup "com.github.badasintended" - } - } + maven { url "https://bai.jfrog.io/artifactory/maven" } } dependencies { @@ -33,7 +28,7 @@ allprojects { modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric}" - modApi "com.github.badasintended:wthit:${rootProject.wthit}" + modApi "mcp.mobius.waila:wthit-fabric:${rootProject.wthit}" } task sourcesJar(type: Jar, dependsOn: classes) { diff --git a/gradle.properties b/gradle.properties index 1d6d776..5e1b5b1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,11 +9,11 @@ group = com.github.badasintended archivesBaseName = megane # Dependencies -fabric = 0.30.3+1.16 -wthit = 2.2.1 +fabric = 0.32.0+1.16 +wthit = 2.5.4 trEnergy = 0.1.0 -lba = 0.8.4 -modmenu = 1.14.6+build.31 +lba = 0.8.7 +modmenu = 1.16.8 # Databreaker databreaker = 0.2.6 diff --git a/megane-api/src/main/resources/fabric.mod.json b/megane-api/src/main/resources/fabric.mod.json index 554e1a8..a723c5a 100644 --- a/megane-api/src/main/resources/fabric.mod.json +++ b/megane-api/src/main/resources/fabric.mod.json @@ -18,6 +18,8 @@ "waila": "*" }, "custom" : { - "modmenu:parent": "megane" + "modmenu": { + "parent": "megane" + } } } diff --git a/megane-impl/build.gradle b/megane-impl/build.gradle index 533a6fe..1eb47ce 100644 --- a/megane-impl/build.gradle +++ b/megane-impl/build.gradle @@ -2,26 +2,26 @@ repositories { maven { url "https://raw.githubusercontent.com/Technici4n/Technici4n-maven/master/" } maven { url "https://server.bbkr.space/artifactory/libs-release" } maven { url "https://mod-buildcraft.com/maven" } - maven { url "https://dl.bintray.com/ladysnake/libs" } + maven { url "https://ladysnake.jfrog.io/artifactory/mods" } maven { url "https://www.cursemaven.com" } } dependencies { implementation project(":megane-api") - modCompileOnly "dev.technici4n:FastTransferLib:0.2.1" + modCompileOnly "dev.technici4n:FastTransferLib:0.3.1" - modCompileOnly "alexiil.mc.lib:libblockattributes-fluids:0.8.4" - modCompileOnly "alexiil.mc.lib:libblockattributes-items:0.8.4" + modCompileOnly "alexiil.mc.lib:libblockattributes-fluids:0.8.7" + modCompileOnly "alexiil.mc.lib:libblockattributes-items:0.8.7" - modCompileOnly "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-base:2.7.4" + modCompileOnly "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-base:2.7.13" - modCompileOnly "io.github.cottonmc:LibGui:3.2.2+1.16.3" + modCompileOnly "io.github.cottonmc:LibGui:3.3.5+1.16.5" modCompileOnly "teamreborn:energy:0.1.0" - modCompileOnly "TechReborn:TechReborn-1.16:3.8.0+build.205" + modCompileOnly "TechReborn:TechReborn-1.16:3.8.2+build.220" - modCompileOnly "curse.maven:applied-energistics-2-223794:3117933" + modCompileOnly "curse.maven:applied-energistics-2-223794:3225596" modCompileOnly "curse.maven:astromine-core-405058:3080151" modCompileOnly "curse.maven:astromine-foundations-404374:3080153" @@ -29,11 +29,11 @@ dependencies { modCompileOnly "curse.maven:fabric-furnaces-315534:3155774" - modCompileOnly "curse.maven:indrev-391708:3207757" + modCompileOnly "curse.maven:indrev-391708:3233516" - modCompileOnly "curse.maven:modern-industrialization-405388:3186480" + modCompileOnly "curse.maven:modern-industrialization-405388:3232104" modCompileOnly "curse.maven:art-of-alchemy-415339:3106070" - modCompileOnly "curse.maven:kibe-388832:3183761" + modCompileOnly "curse.maven:kibe-388832:3239422" } diff --git a/megane-impl/src/main/java/badasintended/megane/impl/IndustrialRevolution.java b/megane-impl/src/main/java/badasintended/megane/impl/IndustrialRevolution.java index d23d68a..13c2b49 100644 --- a/megane-impl/src/main/java/badasintended/megane/impl/IndustrialRevolution.java +++ b/megane-impl/src/main/java/badasintended/megane/impl/IndustrialRevolution.java @@ -7,7 +7,11 @@ import badasintended.megane.api.provider.FluidProvider; import badasintended.megane.api.provider.ProgressProvider; import me.steven.indrev.blockentities.MachineBlockEntity; +import me.steven.indrev.blockentities.crafters.CompressorFactoryBlockEntity; import me.steven.indrev.blockentities.crafters.CraftingMachineBlockEntity; +import me.steven.indrev.blockentities.crafters.ElectricFurnaceFactoryBlockEntity; +import me.steven.indrev.blockentities.crafters.SolidInfuserFactoryBlockEntity; +import me.steven.indrev.blockentities.modularworkbench.ModularWorkbenchBlockEntity; import me.steven.indrev.blockentities.storage.TankBlockEntity; import me.steven.indrev.fluids.BaseFluid; import net.fabricmc.api.EnvType; @@ -22,25 +26,38 @@ public class IndustrialRevolution implements MeganeModule { - @Override - @SuppressWarnings("ConstantConditions") - public void initialize() { - ENERGY.register(MachineBlockEntity.class, EnergyProvider.of( - MachineBlockEntity::getEnergy, - MachineBlockEntity::getEnergyCapacity - )); - - PROGRESS.register(CraftingMachineBlockEntity.class, ProgressProvider.of( + public > void progress(Class clazz, int amount, int currentIndex, int maxIndex) { + PROGRESS.register(clazz, ProgressProvider.of( b -> b.getInventoryComponent().getInventory().getInputSlots(), b -> b.getInventoryComponent().getInventory().getOutputSlots(), (b, i) -> b.getInventoryComponent().getInventory().getStack(i), b -> { PropertyDelegate property = b.getPropertyDelegate(); - double max = property.get(4); - double current = property.get(3); - return (int) ((max - current) / max * 100); + int result = 0; + int j = 1; + for (int i = 0; i < amount; i++) { + double current = property.get(currentIndex + (i * 2)); + double max = property.get(maxIndex + (i * 2)); + result = Math.max(result, (int) (current / max * 100)); + } + return result; } )); + } + + @Override + public void initialize() { + ENERGY.register(MachineBlockEntity.class, EnergyProvider.of( + MachineBlockEntity::getEnergy, + MachineBlockEntity::getEnergyCapacity + )); + + progress(CraftingMachineBlockEntity.class, 1, 4, 5); + progress(CompressorFactoryBlockEntity.class, 5, 4, 5); + progress(CompressorFactoryBlockEntity.class, 5, 4, 5); + progress(SolidInfuserFactoryBlockEntity.class, 5, 4, 5); + progress(ElectricFurnaceFactoryBlockEntity.class, 5, 4, 5); + progress(ModularWorkbenchBlockEntity.class, 1, 2, 3); FLUID.register(MachineBlockEntity.class, FluidProvider.of( t -> t.getFluidComponent() != null, diff --git a/megane-impl/src/main/java/badasintended/megane/impl/mixin/MixinPlugin.java b/megane-impl/src/main/java/badasintended/megane/impl/mixin/MixinPlugin.java index b1fdc0d..59500a5 100644 --- a/megane-impl/src/main/java/badasintended/megane/impl/mixin/MixinPlugin.java +++ b/megane-impl/src/main/java/badasintended/megane/impl/mixin/MixinPlugin.java @@ -6,6 +6,7 @@ import java.util.Set; import mcp.mobius.waila.utils.JsonConfig; +import net.fabricmc.loader.api.FabricLoader; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.objectweb.asm.tree.ClassNode; @@ -16,7 +17,10 @@ public class MixinPlugin implements IMixinConfigPlugin { private static final Logger LOGGER = LogManager.getLogger("megane-impl-mixin"); private static final String PREFIX = "badasintended.megane.impl.mixin."; - private static final JsonConfig CONFIG = new JsonConfig<>("waila/megane-impl-mixin", Config.class); + private static final JsonConfig CONFIG = new JsonConfig<>( + FabricLoader.getInstance().getConfigDir().resolve("waila/megane-impl-mixin.json").toFile(), + Config.class + ); @Override public void onLoad(String mixinPackage) { diff --git a/megane-impl/src/main/resources/fabric.mod.json b/megane-impl/src/main/resources/fabric.mod.json index 2b4f22e..671dcef 100644 --- a/megane-impl/src/main/resources/fabric.mod.json +++ b/megane-impl/src/main/resources/fabric.mod.json @@ -56,6 +56,8 @@ "init": "badasintended.megane.impl.TechReborn" } ], - "modmenu:parent": "megane" + "modmenu": { + "parent": "megane" + } } } diff --git a/megane-runtime/build.gradle b/megane-runtime/build.gradle index 4b21969..ba69097 100644 --- a/megane-runtime/build.gradle +++ b/megane-runtime/build.gradle @@ -7,5 +7,5 @@ dependencies { modImplementation "teamreborn:energy:${rootProject.trEnergy}" modImplementation("alexiil.mc.lib:libblockattributes-fluids:${rootProject.lba}") { exclude group: "net.fabricmc.fabric-api" } - modImplementation("io.github.prospector:modmenu:${rootProject.modmenu}") { exclude group: "net.fabricmc.fabric-api" } + modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu}") { exclude group: "net.fabricmc.fabric-api" } } diff --git a/megane-runtime/src/main/java/badasintended/megane/runtime/config/MeganeModMenu.java b/megane-runtime/src/main/java/badasintended/megane/runtime/config/MeganeModMenu.java index 1fae041..98ebca5 100644 --- a/megane-runtime/src/main/java/badasintended/megane/runtime/config/MeganeModMenu.java +++ b/megane-runtime/src/main/java/badasintended/megane/runtime/config/MeganeModMenu.java @@ -1,8 +1,8 @@ package badasintended.megane.runtime.config; import badasintended.megane.runtime.config.screen.MeganeConfigScreen; -import io.github.prospector.modmenu.api.ConfigScreenFactory; -import io.github.prospector.modmenu.api.ModMenuApi; +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; public class MeganeModMenu implements ModMenuApi { diff --git a/megane-runtime/src/main/java/badasintended/megane/runtime/data/block/ProgressData.java b/megane-runtime/src/main/java/badasintended/megane/runtime/data/block/ProgressData.java index 0afb865..0fa2ce9 100644 --- a/megane-runtime/src/main/java/badasintended/megane/runtime/data/block/ProgressData.java +++ b/megane-runtime/src/main/java/badasintended/megane/runtime/data/block/ProgressData.java @@ -43,26 +43,36 @@ public boolean append(CompoundTag data, ServerPlayerEntity player, World world, int[] inputs = provider.getInputSlots(blockEntity); int[] outputs = provider.getOutputSlots(blockEntity); - data.putInt(P_I_SIZE, inputs.length); - data.putInt(P_O_SIZE, outputs.length); + int i = 0; for (int input : inputs) { ItemStack stack = provider.getStack(blockEntity, input); + if (stack.isEmpty()) { + continue; + } CompoundTag tag = stack.getTag(); - data.putInt(P_I_ID, Registry.ITEM.getRawId(stack.getItem())); - data.putInt(P_I_COUNT, stack.getCount()); - data.put(P_I_NBT, tag == null ? EMPTY_TAG : tag); + data.putInt(P_I_ID + i, Registry.ITEM.getRawId(stack.getItem())); + data.putInt(P_I_COUNT + i, stack.getCount()); + data.put(P_I_NBT + i, tag == null ? EMPTY_TAG : tag); + i++; } + data.putInt(P_I_SIZE, i); data.putInt(P_PERCENT, provider.getPercentage(blockEntity)); + i = 0; for (int output : outputs) { ItemStack stack = provider.getStack(blockEntity, output); + if (stack.isEmpty()) { + continue; + } CompoundTag tag = stack.getTag(); - data.putInt(P_O_ID, Registry.ITEM.getRawId(stack.getItem())); - data.putInt(P_O_COUNT, stack.getCount()); - data.put(P_O_NBT, tag == null ? EMPTY_TAG : tag); + data.putInt(P_O_ID + i, Registry.ITEM.getRawId(stack.getItem())); + data.putInt(P_O_COUNT + i, stack.getCount()); + data.put(P_O_NBT + i, tag == null ? EMPTY_TAG : tag); + i++; } + data.putInt(P_O_SIZE, outputs.length); return true; } diff --git a/megane-runtime/src/main/java/badasintended/megane/runtime/mixin/MGuiConfigPlugins.java b/megane-runtime/src/main/java/badasintended/megane/runtime/mixin/MGuiConfigPlugins.java index af67579..f6cf636 100644 --- a/megane-runtime/src/main/java/badasintended/megane/runtime/mixin/MGuiConfigPlugins.java +++ b/megane-runtime/src/main/java/badasintended/megane/runtime/mixin/MGuiConfigPlugins.java @@ -17,7 +17,7 @@ public class MGuiConfigPlugins { @Inject(method = "getOptions", at = @At("TAIL"), remap = false) private void add(CallbackInfoReturnable cir) { - cir.getReturnValue().children().add(0, new OptionsEntryButton("config.waila.megane", new ButtonWidget(0, 0, 100, 20, LiteralText.EMPTY, w -> + cir.getReturnValue().children().add(1, new OptionsEntryButton("config.waila.megane", new ButtonWidget(0, 0, 100, 20, LiteralText.EMPTY, w -> MinecraftClient.getInstance().openScreen(new MeganeConfigScreen((GuiConfigPlugins) (Object) this)) ))); } diff --git a/megane-runtime/src/main/java/badasintended/megane/runtime/renderer/ProgressRenderer.java b/megane-runtime/src/main/java/badasintended/megane/runtime/renderer/ProgressRenderer.java index bfd7a97..b0d0784 100644 --- a/megane-runtime/src/main/java/badasintended/megane/runtime/renderer/ProgressRenderer.java +++ b/megane-runtime/src/main/java/badasintended/megane/runtime/renderer/ProgressRenderer.java @@ -40,7 +40,7 @@ public void draw(MatrixStack matrices, CompoundTag data, ICommonAccessor accesso for (int i = 0; i < inputCount; i++) { ItemStack stack = new ItemStack(Registry.ITEM.get(data.getInt(P_I_ID + i)), data.getInt(P_I_COUNT + i)); - stack.setTag(data.getCompound(P_I_NBT)); + stack.setTag(data.getCompound(P_I_NBT + i)); if (stack.isEmpty()) { inputCount--; i--; @@ -54,7 +54,7 @@ public void draw(MatrixStack matrices, CompoundTag data, ICommonAccessor accesso for (int i = 0; i < outputCount; i++) { ItemStack stack = new ItemStack(Registry.ITEM.get(data.getInt(P_O_ID + i)), data.getInt(P_O_COUNT + i)); - stack.setTag(data.getCompound(P_O_NBT)); + stack.setTag(data.getCompound(P_O_NBT + i)); drawStack(stack, x + (inputCount * 18) + 26 + (i * 18), y + 1); } } diff --git a/megane-runtime/src/main/resources/fabric.mod.json b/megane-runtime/src/main/resources/fabric.mod.json index ca7be81..f5ca05e 100644 --- a/megane-runtime/src/main/resources/fabric.mod.json +++ b/megane-runtime/src/main/resources/fabric.mod.json @@ -7,7 +7,7 @@ "deirn" ], "contributors" : [ - "qsefthuopq - Simplified Chinese Translator" + "qsefthuopq" ], "contact" : { "homepage": "https://github.com/badasintended/megane", @@ -39,6 +39,8 @@ "id" : "megane:plugin", "initializer": "badasintended.megane.runtime.MeganeWaila" }, - "modmenu:parent": "megane" + "modmenu": { + "parent": "megane" + } } } diff --git a/settings.gradle b/settings.gradle index 6f9ad73..387c67f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,5 @@ pluginManagement { repositories { - jcenter() maven { name = 'Fabric' url = 'https://maven.fabricmc.net/' diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 0b3ea85..70e29af 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -5,6 +5,9 @@ "name" : "megane", "description" : "hwyla plugin that shows more tooltip than you'll ever want", "authors" : ["deirn"], + "contributors" : [ + "qsefthuopq" + ], "contact" : { "homepage": "https://github.com/badasintended/megane", "sources" : "https://github.com/badasintended/megane", @@ -19,6 +22,6 @@ "depends" : { "fabricloader": ">=0.7.4", "minecraft" : "1.16.x", - "waila" : "*" + "wthit" : "*" } }