diff options
7 files changed, 83 insertions, 59 deletions
diff --git a/build.gradle b/build.gradle index 7b1f6c4507..055dcee435 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1679040806 +//version: 1680120787 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -65,7 +65,7 @@ plugins { id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false - id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version ,unused, available for addon.gradle + id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle id 'com.github.johnrengelman.shadow' version '7.1.2' apply false id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version id 'de.undercouch.download' version '5.3.0' @@ -73,7 +73,7 @@ plugins { id 'com.diffplug.spotless' version '6.7.2' apply false id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.2.3' + id 'com.gtnewhorizons.retrofuturagradle' version '1.2.4' } boolean settingsupdated = verifySettingsGradle() settingsupdated = verifyGitAttributes() || settingsupdated @@ -160,6 +160,14 @@ java { } } +tasks.withType(JavaCompile).configureEach { + options.encoding = "UTF-8" +} + +tasks.withType(ScalaCompile).configureEach { + options.encoding = "UTF-8" +} + pluginManager.withPlugin('org.jetbrains.kotlin.jvm') { // If Kotlin is enabled in the project kotlin { @@ -397,8 +405,6 @@ minecraft { extraRunJvmArguments.add("-ea:${modGroup}") if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - extraTweakClasses.add("org.spongepowered.asm.launch.MixinTweaker") - if (usesMixinDebug.toBoolean()) { extraRunJvmArguments.addAll([ "-Dmixin.debug.countInjections=true", @@ -513,14 +519,6 @@ repositories { url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" allowInsecureProtocol = true } - if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - if (usesMixinDebug.toBoolean()) { - maven { - name = "Fabric Maven" - url = "https://maven.fabricmc.net/" - } - } - } maven { name 'sonatype' url 'https://oss.sonatype.org/content/repositories/snapshots/' @@ -559,29 +557,49 @@ repositories { } } +def mixinProviderGroup = "io.github.legacymoddingmc" +def mixinProviderModule = "unimixins" +def mixinProviderVersion = "0.1.6" +def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}" +def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev" + dependencies { if (usesMixins.toBoolean()) { annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.code.gson:gson:2.8.6') - annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.13:processor') + annotationProcessor(mixinProviderSpec) if (usesMixinDebug.toBoolean()) { runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16') } } - if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - implementation('com.gtnewhorizon:gtnhmixins:2.1.13') + if (usesMixins.toBoolean()) { + implementation(mixinProviderSpec) + } else if (forceEnableMixins.toBoolean()) { + runtimeOnlyNonPublishable(mixinProviderSpec) } } pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { if (usesMixins.toBoolean()) { dependencies { - kapt('com.gtnewhorizon:gtnhmixins:2.1.13:processor') + kapt(mixinProviderSpec) } } } +// Replace old mixin mods with unimixins +// https://docs.gradle.org/8.0.2/userguide/resolution_rules.html#sec:substitution_with_classifier +configurations.all { + resolutionStrategy.dependencySubstitution { + substitute module('com.gtnewhorizon:gtnhmixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") + substitute module('com.github.GTNewHorizons:Mixingasm') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") + substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") + substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") + substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier") + } +} + apply from: 'dependencies.gradle' def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' @@ -695,13 +713,13 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies" } dependencies { - def lwjgl3ifyVersion = '1.2.2' + def lwjgl3ifyVersion = '1.3.3' def asmVersion = '9.4' if (modId != 'lwjgl3ify') { java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") } if (modId != 'hodgepodge') { - java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.1.0') + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.4') } java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} @@ -793,10 +811,6 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask { !file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2 } this.classpath(project.java17DependenciesCfg) - - if (!(project.usesMixins.toBoolean() || project.forceEnableMixins.toBoolean())) { - this.extraArgs.addAll("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker") - } } } @@ -1006,6 +1020,7 @@ idea { } compiler.javac { afterEvaluate { + javacAdditionalOptions = "-encoding utf8" moduleJavacAdditionalOptions = [ (project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ') ] @@ -1125,7 +1140,7 @@ if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) { } } if (usesMixins.toBoolean()) { - addModrinthDep("required", "project", "gtnhmixins") + addModrinthDep("required", "project", "unimixins") } tasks.modrinth.dependsOn(build) tasks.publish.dependsOn(tasks.modrinth) @@ -1169,7 +1184,7 @@ if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null } } if (usesMixins.toBoolean()) { - addCurseForgeRelation("requiredDependency", "gtnhmixins") + addCurseForgeRelation("requiredDependency", "unimixins") } tasks.curseforge.dependsOn(build) tasks.publish.dependsOn(tasks.curseforge) diff --git a/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java b/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java index 732dbba88a..43ce98009d 100644 --- a/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java +++ b/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java @@ -9,6 +9,7 @@ import java.util.function.Function; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizons.modularui.api.drawable.IDrawable; @@ -22,6 +23,7 @@ import com.gtnewhorizons.modularui.common.builder.UIInfo; import com.gtnewhorizons.modularui.common.internal.wrapper.ModularGui; import com.gtnewhorizons.modularui.common.internal.wrapper.ModularUIContainer; +import gregtech.api.enums.GT_Values; import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; @@ -30,6 +32,9 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPow public abstract class KubaTechGTMultiBlockBase<T extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T>> extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T> { + @Deprecated + public final int mEUt = 0; + @SuppressWarnings("unchecked") protected static <K extends KubaTechGTMultiBlockBase<?>> UIInfo<?, ?> createKTMetaTileEntityUI( KTContainerConstructor<K> containerConstructor) { @@ -160,6 +165,14 @@ public abstract class KubaTechGTMultiBlockBase<T extends GT_MetaTileEntity_Exten return calculateOverclock(aEUt, aDuration, true); } + public int getVoltageTier() { + return (int) getVoltageTierExact(); + } + + public double getVoltageTierExact() { + return Math.log((double) getMaxInputEu() / 8d) / ln4 + 1e-8d; + } + @Override public boolean isCorrectMachinePart(ItemStack aStack) { return true; @@ -180,7 +193,11 @@ public abstract class KubaTechGTMultiBlockBase<T extends GT_MetaTileEntity_Exten return false; } - // ModularUI stuff + // UI stuff + + protected static String voltageTooltipFormatted(int tier) { + return GT_Values.TIER_COLORS[tier] + GT_Values.VN[tier] + EnumChatFormatting.GRAY; + } protected final Function<Widget, Boolean> isFixed = widget -> getIdealStatus() == getRepairStatus() && mMachine; protected static final Function<Integer, IDrawable[]> toggleButtonBackgroundGetter = val -> { diff --git a/src/main/java/kubatech/loaders/MobRecipeLoader.java b/src/main/java/kubatech/loaders/MobRecipeLoader.java index bfa94eb632..dde418aaac 100644 --- a/src/main/java/kubatech/loaders/MobRecipeLoader.java +++ b/src/main/java/kubatech/loaders/MobRecipeLoader.java @@ -273,7 +273,7 @@ public class MobRecipeLoader { EnchantmentHelper .addRandomEnchantment(rnd, infernalstack, infernalstack.getItem().getItemEnchantability()); stacks.add(infernalstack); - MTE.mEUt *= 8L; + MTE.lEUt *= 8L; MTE.mMaxProgresstime *= mods * InfernalMobsCore.instance().getMobModHealthFactor(); } } diff --git a/src/main/java/kubatech/mixin/MixinPlugin.java b/src/main/java/kubatech/mixin/MixinPlugin.java index 31f1a67a9e..8d89f16a40 100644 --- a/src/main/java/kubatech/mixin/MixinPlugin.java +++ b/src/main/java/kubatech/mixin/MixinPlugin.java @@ -20,9 +20,9 @@ import net.minecraft.launchwrapper.Launch; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.spongepowered.asm.lib.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import org.spongepowered.asm.mixin.extensibility.IMixinInfo; -import org.spongepowered.libraries.org.objectweb.asm.tree.ClassNode; import com.gtnewhorizon.gtnhmixins.MinecraftURLClassPath; diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java index f7e2fee904..a35c275bcd 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java @@ -449,13 +449,13 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber return false; if (isInRitualMode && isRitualValid()) { - if (getMaxInputVoltage() < recipe.mEUt / 4) return false; + if (getMaxInputEu() < recipe.mEUt / 4) return false; this.mOutputFluids = new FluidStack[] { FluidRegistry.getFluidStack("xpjuice", 5000) }; this.mOutputItems = recipe.generateOutputs(rand, this, 3, 0, mIsProducingInfernalDrops); this.lEUt /= 4L; this.mMaxProgresstime = 400; } else { - if (getMaxInputVoltage() < recipe.mEUt) return false; + if (getMaxInputEu() < recipe.mEUt) return false; double attackDamage = DIAMOND_SPIKES_DAMAGE; // damage from spikes GT_MetaTileEntity_Hatch_InputBus inputbus = this.mInputBusses.size() == 0 ? null : this.mInputBusses.get(0); diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java index e8ddcb29b9..372fe819e2 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java @@ -227,10 +227,6 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && f.isNotFlipped(); } - private static String tierString(int tier) { - return GT_Values.TIER_COLORS[tier] + GT_Values.VN[tier] + EnumChatFormatting.RESET + EnumChatFormatting.GRAY; - } - @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); @@ -248,18 +244,21 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse .addInfo("[IC2] You need to also input block that is required under the crop") .addInfo("Output mode: machine will take planted seeds and output them") .addInfo("-------------------- NORMAL CROPS --------------------") - .addInfo("Minimal tier: " + tierString(4)).addInfo("Starting with 1 slot") + .addInfo("Minimal tier: " + voltageTooltipFormatted(4)).addInfo("Starting with 1 slot") .addInfo("Every slot gives 64 crops") - .addInfo("Every tier past " + tierString(4) + ", slots are multiplied by 2") + .addInfo("Every tier past " + voltageTooltipFormatted(4) + ", slots are multiplied by 2") .addInfo("Base process time: 5 sec") - .addInfo("Process time is divided by number of tiers past " + tierString(3) + " (Minimum 1 sec)") + .addInfo( + "Process time is divided by number of tiers past " + voltageTooltipFormatted(3) + + " (Minimum 1 sec)") .addInfo("All crops are grown at the end of the operation") .addInfo("Will automatically craft seeds if they are not dropped") .addInfo("1 Fertilizer per 1 crop +200%") .addInfo("-------------------- IC2 CROPS --------------------") - .addInfo("Minimal tier: " + tierString(6)).addInfo("Need " + tierString(6) + " glass tier") - .addInfo("Starting with 4 slots").addInfo("Every slot gives 1 crop") - .addInfo("Every tier past " + tierString(6) + ", slots are multiplied by 4") + .addInfo("Minimal tier: " + voltageTooltipFormatted(6)) + .addInfo("Need " + voltageTooltipFormatted(6) + " glass tier").addInfo("Starting with 4 slots") + .addInfo("Every slot gives 1 crop") + .addInfo("Every tier past " + voltageTooltipFormatted(6) + ", slots are multiplied by 4") .addInfo("Process time: 5 sec").addInfo("All crops are accelerated by x32 times") .addInfo("1 Fertilizer per 1 crop +10%").addInfo(StructureHologram).addSeparator() .beginStructureBlock(5, 6, 5, false).addController("Front bottom center") @@ -336,8 +335,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse } private void updateMaxSlots() { - long v = this.getMaxInputVoltage(); - int tier = GT_Utility.getTier(v); + int tier = getVoltageTier(); if (tier < (isIC2Mode ? 6 : 4)) mMaxSlots = 0; else if (isIC2Mode) mMaxSlots = 4 << (2 * (tier - 6)); else mMaxSlots = 1 << (tier - 4); @@ -345,8 +343,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse @Override public boolean checkRecipe(ItemStack itemStack) { - long v = this.getMaxInputVoltage(); - int tier = GT_Utility.getTier(v); + int tier = getVoltageTier(); updateMaxSlots(); if (oldVersion != EIG_MATH_VERSION) { @@ -385,7 +382,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse this.updateSlots(); this.mMaxProgresstime = 5; - this.mEUt = 0; + this.lEUt = 0; this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; return true; @@ -478,7 +475,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse } this.mOutputItems = outputs.toArray(new ItemStack[0]); } - this.mEUt = -(int) ((double) GT_Values.V[tier] * 0.99d); + this.lEUt = -(int) ((double) GT_Values.V[tier] * 0.99d); this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; this.updateSlots(); diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java index c91efacb4c..a17af113c0 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java @@ -26,7 +26,6 @@ import java.util.stream.IntStream; import kubatech.Tags; import kubatech.api.LoaderReference; -import kubatech.api.helpers.GTHelper; import kubatech.api.implementations.KubaTechGTMultiBlockBase; import kubatech.client.effect.MegaApiaryBeesRenderer; @@ -227,10 +226,6 @@ public class GT_MetaTileEntity_MegaIndustrialApiary return (d, r, f) -> d.offsetY == 0 && r.isNotRotated(); } - private String voltageFormatted(int v) { - return GT_Values.TIER_COLORS[v] + GT_Values.VN[v] + EnumChatFormatting.GRAY; - } - @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); @@ -244,9 +239,9 @@ public class GT_MetaTileEntity_MegaIndustrialApiary .addInfo("-------------------- OUTPUT MODE ---------------------").addInfo("- Does not take power") .addInfo("- Will give your bees back to output bus") .addInfo("------------------- OPERATING MODE -------------------").addInfo("- NORMAL:") - .addInfo(" - For each " + voltageFormatted(6) + " amp you can insert 1 bee") + .addInfo(" - For each " + voltageTooltipFormatted(6) + " amp you can insert 1 bee") .addInfo(" - Processing time: 5 seconds") - .addInfo(" - Uses 1 " + voltageFormatted(6) + " amp per queen") + .addInfo(" - Uses 1 " + voltageTooltipFormatted(6) + " amp per queen") .addInfo(" - All bees are accelerated 64 times").addInfo(" - 8 production upgrades are applied") .addInfo(" - Genetic Stabilizer upgrade applied") .addInfo(" - Simulates perfect environment for your bees") @@ -257,7 +252,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary .addInfo("- SWARMER:").addInfo(" - You can only insert 1 queen") .addInfo(" - It will slowly produce ignoble princesses") .addInfo(" - Consumes 100 royal jelly per operation").addInfo(" - Base processing time: 1 minute") - .addInfo(" - Uses 1 amp " + voltageFormatted(5)).addInfo(" - Can overclock") + .addInfo(" - Uses 1 amp " + voltageTooltipFormatted(5)).addInfo(" - Can overclock") .addInfo(StructureHologram).addSeparator().beginStructureBlock(15, 17, 15, false) .addController("Front Bottom Center").addCasingInfoMin("Bronze Plated Bricks", 190, false) .addOtherStructurePart("Borosilicate Glass", "Look at the hologram") @@ -374,7 +369,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary if (mPrimaryMode < 2) { if (mPrimaryMode == 0 && mStorage.size() < mMaxSlots) { World w = getBaseMetaTileEntity().getWorld(); - float t = (float) GTHelper.getVoltageTierD(this); + float t = (float) getVoltageTierExact(); ArrayList<ItemStack> inputs = getStoredInputs(); for (ItemStack input : inputs) { if (beeRoot.getType(input) == EnumBeeType.QUEEN) { @@ -405,7 +400,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary if (megaApiaryStorageVersion != MEGA_APIARY_STORAGE_VERSION) { megaApiaryStorageVersion = MEGA_APIARY_STORAGE_VERSION; World w = getBaseMetaTileEntity().getWorld(); - float t = (float) GTHelper.getVoltageTierD(this); + float t = (float) getVoltageTierExact(); mStorage.forEach(s -> s.generate(w, t)); } @@ -414,7 +409,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary if (flowersError) return false; if (needsTVarUpdate) { - float t = (float) GTHelper.getVoltageTierD(this); + float t = (float) getVoltageTierExact(); needsTVarUpdate = false; mStorage.forEach(s -> s.updateTVar(t)); } @@ -603,7 +598,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary return super.transferStackInSlot(aPlayer, aSlotIndex); } World w = mte.getBaseMetaTileEntity().getWorld(); - float t = (float) GTHelper.getVoltageTierD(mte); + float t = (float) mte.getVoltageTierExact(); BeeSimulator bs = new BeeSimulator(aStack, w, t); if (bs.isValid) { mte.mStorage.add(bs); @@ -727,7 +722,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary } if (beeRoot.getType(input) == EnumBeeType.QUEEN) { World w = getBaseMetaTileEntity().getWorld(); - float t = (float) GTHelper.getVoltageTierD(this); + float t = (float) getVoltageTierExact(); BeeSimulator bs = new BeeSimulator(input, w, t); if (bs.isValid) { if (mStorage.size() > ID) { |