diff --git a/build.gradle.kts b/build.gradle.kts index cfe9b7919b..40d82320b9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,6 +4,7 @@ import com.hypherionmc.modpublisher.plugin.ModPublisherGradleExtension import xyz.wagyourtail.jvmdg.gradle.task.files.DowngradeFiles import xyz.wagyourtail.replace_str.ProcessClasses import xyz.wagyourtail.unimined.api.UniminedExtension +import xyz.wagyourtail.unimined.api.minecraft.patch.fabric.FabricLikePatcher import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import java.util.* @@ -124,6 +125,9 @@ subprojects { } repositories { + flatDir { + dirs("$rootDir/libs") + } mavenLocal() mavenCentral() // ModLoader Mavens @@ -172,122 +176,32 @@ subprojects { extensions.getByType().minecraft(sourceSets.getByName("main"), true) { side(if (isJarMod) "client" else "combined") - version(mcVersion) - - mappings { - val mcMappings = "mc_mappings"()!! - when (mcMappingsType) { - "mcp" -> { - if (!isJarMod) { - searge() - } - mcp(if (isJarMod) "legacy" else "stable", mcMappings) { - if (!isJarMod) { - clearOutputs() - outputs("mcp", true) { listOf("intermediary") } - } - } - } - - "forgeMCP" -> { - forgeBuiltinMCP("forge_version"()!!) { - clearContains() - clearOutputs() - contains({ _, t -> - !t.contains("MCP") - }) { - onlyExistingSrc() - outputs("searge", false) { listOf("official") } - } - contains({ _, t -> - t.contains("MCP") - }) { - outputs("mcp", true) { listOf("intermediary") } - sourceNamespace("searge") - } - } - officialMappingsFromJar { - clearContains() - clearOutputs() - outputs("official", false) { listOf() } - } - } - - "retroMCP" -> { - retroMCP(mcMappings) - } + version("empty-$mcVersion") - "yarn" -> { - yarn(mcMappings) - } - - "mojmap" -> { - mojmap { - skipIfNotIn("intermediary") - } - } - - "parchment" -> { - mojmap { - skipIfNotIn("intermediary") - } - parchment(mcVersion, mcMappings) - } - - else -> throw GradleException("Unknown or Unsupported Mappings version") + defaultRemapJar = false + val fabricData: FabricLikePatcher.() -> Unit = { + if (accessWidenerFile.exists()) { + accessWidener(accessWidenerFile) } - - // Only use Intermediaries on Versions that support it - val usingIntermediary = (isLegacy && protocol >= 39) || !isLegacy - if (usingIntermediary) { - if (isModern) { - intermediary() - } else { - legacyIntermediary() - } - } - - // ability to add custom mappings - val target = if (!isModern) "mcp" else "mojmap" - stub.withMappings("searge", target) { - c("ModLoader", "net/minecraft/src/ModLoader", "net/minecraft/src/ModLoader") - c("BaseMod", "net/minecraft/src/BaseMod", "net/minecraft/src/BaseMod") - // Fix: Fixed an inconsistent mapping in 1.16 and 1.16.1 between MCP and Mojmap - if (!isLegacy && (protocol == 735 || protocol == 736)) { - c( - "dng", - listOf( - "net/minecraft/client/gui/widget/Widget", - "net/minecraft/client/gui/components/AbstractWidget" - ) - ) { - m("e", "()I", "func_238483_d_", "getHeightRealms") - } - } + loader("fabric_loader_version"()!!) + if (isJarMod) { + prodNamespace("official") + devMappings = null } - - if (isMCPJar) { - if (protocol <= 2) { // MC a1.1.2_01 and below - devNamespace("searge") - } else { - devFallbackNamespace("searge") - } - } else if (usingIntermediary) { - devFallbackNamespace("intermediary") + customIntermediaries = true + } + if (isModern) { + fabric(fabricData) + } else { + merged { + legacyFabric(fabricData) + jarMod {} } + } - if (shouldDowngrade) { - val apiVersion = if (buildVersion.isJava7) JavaVersion.VERSION_1_8 else buildVersion - val downgradeClient = tasks.register("downgradeClient", DowngradeFiles::class.java) { - inputCollection = sourceSet.output.classesDirs + sourceSet.runtimeClasspath - classpath = project.files() - outputCollection.files - } - - runs.config("client") { - classpath = downgradeClient.get().outputCollection + files(jvmdg.getDowngradedApi(apiVersion)) - } - } + mappings { + devNamespace("official") + devFallbackNamespace("official") } minecraftRemapper.config { @@ -310,7 +224,7 @@ subprojects { "compileOnly"("com.github.spotbugs:spotbugs-annotations:4.8.6") // Attach UniLib dependency - "modImplementation"( + "implementation"( "com.gitlab.cdagaming.unilib:$libPrefix-${ libName.replaceFirstChar { if (it.isLowerCase()) it.titlecase( @@ -440,7 +354,7 @@ subprojects { jvmdg.debugSkipStubs.add(JavaVersion.VERSION_1_8) } - val resultJar = tasks.getByName("remapJar") + val resultJar = tasks.getByName("shadowJar") val resultClassifier = resultJar.archiveClassifier.get() resultJar.archiveClassifier.set("$resultClassifier-native") diff --git a/common/build.gradle.kts b/common/build.gradle.kts index f4854b4b62..7dcddfdc39 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -1,4 +1,3 @@ -import xyz.wagyourtail.unimined.api.minecraft.patch.fabric.FabricLikePatcher import java.util.regex.Pattern /** @@ -23,21 +22,7 @@ val mcVersionLabel: String by extra val fileFormat: String by extra unimined.minecraft { - defaultRemapJar = false - if (!isJarMod) { - val fabricData: FabricLikePatcher.() -> Unit = { - if (accessWidenerFile.exists()) { - accessWidener(accessWidenerFile) - } - loader("fabric_loader_version"()!!) - customIntermediaries = true - } - if (isModern) { - fabric(fabricData) - } else { - legacyFabric(fabricData) - } - } + // N/A } val shadeOnly: Configuration by configurations.creating @@ -48,6 +33,8 @@ configurations.implementation.get().extendsFrom(shade) configurations.runtimeOnly.get().extendsFrom() dependencies { + "jarMod"("local:nsss:${"forge_version"()}") + // Legacy Dependencies, based on Protocol Version if (isLegacy) { if (protocol <= 61) { // MC 1.5.2 and below diff --git a/common/src/main/java/com/gitlab/cdagaming/craftpresence/CraftPresence.java b/common/src/main/java/com/gitlab/cdagaming/craftpresence/CraftPresence.java index 520e0fa019..1bbe881add 100644 --- a/common/src/main/java/com/gitlab/cdagaming/craftpresence/CraftPresence.java +++ b/common/src/main/java/com/gitlab/cdagaming/craftpresence/CraftPresence.java @@ -44,9 +44,9 @@ import io.github.cdagaming.unicore.utils.OSUtils; import io.github.cdagaming.unicore.utils.ScheduleUtils; import net.minecraft.client.Minecraft; -import net.minecraft.src.EntityPlayer; -import net.minecraft.src.Session; -import net.minecraft.src.World; +import net.minecraft.core.entity.player.EntityPlayer; +import net.minecraft.core.player.Session; +import net.minecraft.core.world.World; /** * The Primary Application Class and Utilities diff --git a/common/src/main/java/com/gitlab/cdagaming/craftpresence/config/gui/MainGui.java b/common/src/main/java/com/gitlab/cdagaming/craftpresence/config/gui/MainGui.java index 2e810d5f42..79ee3b1ab1 100644 --- a/common/src/main/java/com/gitlab/cdagaming/craftpresence/config/gui/MainGui.java +++ b/common/src/main/java/com/gitlab/cdagaming/craftpresence/config/gui/MainGui.java @@ -33,7 +33,7 @@ import com.gitlab.cdagaming.unilib.utils.gui.controls.ExtendedButtonControl; import com.gitlab.cdagaming.unilib.utils.gui.widgets.ScrollableTextWidget; import io.github.cdagaming.unicore.utils.StringUtils; -import net.minecraft.src.GuiScreen; +import net.minecraft.client.gui.GuiScreen; public class MainGui extends ConfigurationGui { private final Config INSTANCE, DEFAULTS; @@ -232,11 +232,11 @@ calc2, getButtonY(currentY), } @Override - protected void keyTyped(char typedChar, int keyCode) { + public void keyTyped(char typedChar, int keyCode, int mouseX, int mouseY) { if (isEscapeKey(keyCode) && getCurrentData().hasChanged()) { syncData(); } - super.keyTyped(typedChar, keyCode); + super.keyTyped(typedChar, keyCode, mouseX, mouseY); } @Override diff --git a/common/src/main/java/com/gitlab/cdagaming/craftpresence/integrations/replaymod/ReplayModUtils.java b/common/src/main/java/com/gitlab/cdagaming/craftpresence/integrations/replaymod/ReplayModUtils.java index 18e74b2c77..ca89105f2d 100644 --- a/common/src/main/java/com/gitlab/cdagaming/craftpresence/integrations/replaymod/ReplayModUtils.java +++ b/common/src/main/java/com/gitlab/cdagaming/craftpresence/integrations/replaymod/ReplayModUtils.java @@ -31,7 +31,7 @@ import io.github.cdagaming.unicore.utils.FileUtils; import io.github.cdagaming.unicore.utils.MappingUtils; import io.github.cdagaming.unicore.utils.StringUtils; -import net.minecraft.src.GuiScreen; +import net.minecraft.client.gui.GuiScreen; import unilib.external.io.github.classgraph.ClassInfo; import java.util.List; diff --git a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/entity/EntityUtils.java b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/entity/EntityUtils.java index 171391dd8a..548bd4c693 100644 --- a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/entity/EntityUtils.java +++ b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/entity/EntityUtils.java @@ -30,8 +30,8 @@ import com.gitlab.cdagaming.craftpresence.core.impl.ExtendedModule; import com.gitlab.cdagaming.unilib.utils.WorldUtils; import io.github.cdagaming.unicore.utils.StringUtils; -import net.minecraft.src.Entity; -import net.minecraft.src.EntityList; +import net.minecraft.core.entity.Entity; +import net.minecraft.core.entity.EntityDispatcher; import java.util.List; import java.util.Map; @@ -127,8 +127,8 @@ public void clearAttributes() { @Override public void updateData() { - final Entity NEW_CURRENT_TARGET = CraftPresence.instance.objectMouseOver != null && CraftPresence.instance.objectMouseOver.entityHit != null ? CraftPresence.instance.objectMouseOver.entityHit : null; - final Entity NEW_CURRENT_RIDING = CraftPresence.player.ridingEntity; + final Entity NEW_CURRENT_TARGET = CraftPresence.instance.objectMouseOver != null && CraftPresence.instance.objectMouseOver.entity != null ? CraftPresence.instance.objectMouseOver.entity : null; + final Entity NEW_CURRENT_RIDING = CraftPresence.player.vehicle; final boolean hasTargetChanged = !Objects.equals(NEW_CURRENT_TARGET, CURRENT_TARGET); final boolean hasRidingChanged = !Objects.equals(NEW_CURRENT_RIDING, CURRENT_RIDING); @@ -257,7 +257,7 @@ public void updatePresence() { @Override public void getInternalData() { - final Map mappings = (Map) StringUtils.getField(EntityList.class, null, "classToStringMapping", "field_1610_b", "b"); + final Map mappings = (Map) StringUtils.getField(EntityDispatcher.class, null, "classToStringMapping", "field_1610_b", "b"); if (!mappings.values().isEmpty()) { for (Object entityLocationObj : mappings.values()) { final String entityLocation = (String) entityLocationObj; diff --git a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/entity/TileEntityUtils.java b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/entity/TileEntityUtils.java index 0ea4181395..c8a3ac859a 100644 --- a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/entity/TileEntityUtils.java +++ b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/entity/TileEntityUtils.java @@ -29,9 +29,9 @@ import com.gitlab.cdagaming.unilib.ModUtils; import com.gitlab.cdagaming.unilib.utils.ItemUtils; import io.github.cdagaming.unicore.utils.StringUtils; -import net.minecraft.src.Block; -import net.minecraft.src.Item; -import net.minecraft.src.ItemStack; +import net.minecraft.core.block.Block; +import net.minecraft.core.item.Item; +import net.minecraft.core.item.ItemStack; import java.util.List; import java.util.Map; diff --git a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/GuiUtils.java b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/GuiUtils.java index 8cc204c562..69c940a59e 100644 --- a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/GuiUtils.java +++ b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/GuiUtils.java @@ -32,8 +32,8 @@ import io.github.cdagaming.unicore.utils.FileUtils; import io.github.cdagaming.unicore.utils.MappingUtils; import io.github.cdagaming.unicore.utils.StringUtils; -import net.minecraft.src.GuiScreen; -import net.minecraft.src.GuiContainer; +import net.minecraft.client.gui.GuiContainer; +import net.minecraft.client.gui.GuiScreen; import unilib.external.io.github.classgraph.ClassInfo; import java.util.List; diff --git a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/controls/DynamicScrollableList.java b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/controls/DynamicScrollableList.java index f2fdbeb241..6419d2c13a 100644 --- a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/controls/DynamicScrollableList.java +++ b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/controls/DynamicScrollableList.java @@ -38,7 +38,7 @@ import io.github.cdagaming.unicore.utils.MappingUtils; import io.github.cdagaming.unicore.utils.StringUtils; import net.minecraft.client.Minecraft; -import net.minecraft.src.ItemStack; +import net.minecraft.core.item.ItemStack; import unilib.external.io.github.classgraph.ClassInfo; import javax.annotation.Nonnull; diff --git a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/impl/CommandsGui.java b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/impl/CommandsGui.java index 1218de9deb..f32ad0bf80 100644 --- a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/impl/CommandsGui.java +++ b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/impl/CommandsGui.java @@ -481,7 +481,7 @@ private void checkCommands() { } @Override - protected void keyTyped(char typedChar, int keyCode) { + public void keyTyped(char typedChar, int keyCode, int mouseX, int mouseY) { if (!blockInteractions) { if (commandInput.isControlFocused()) { if (isEscapeKey(keyCode)) { @@ -503,7 +503,7 @@ protected void keyTyped(char typedChar, int keyCode) { } } } - super.keyTyped(typedChar, keyCode); + super.keyTyped(typedChar, keyCode, mouseX, mouseY); } } diff --git a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/impl/DynamicSelectorGui.java b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/impl/DynamicSelectorGui.java index c1ff25a266..e220237dd4 100644 --- a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/impl/DynamicSelectorGui.java +++ b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/gui/impl/DynamicSelectorGui.java @@ -27,7 +27,7 @@ import com.gitlab.cdagaming.craftpresence.utils.gui.controls.DynamicScrollableList; import com.gitlab.cdagaming.unilib.utils.gui.impl.SelectorGui; import io.github.cdagaming.unicore.utils.StringUtils; -import net.minecraft.src.GuiScreen; +import net.minecraft.client.gui.GuiScreen; import java.util.List; import java.util.Set; diff --git a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/server/ServerUtils.java b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/server/ServerUtils.java index 25d6cae434..2c62d2a1bb 100644 --- a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/server/ServerUtils.java +++ b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/server/ServerUtils.java @@ -37,7 +37,9 @@ import io.github.cdagaming.unicore.utils.MathUtils; import io.github.cdagaming.unicore.utils.StringUtils; import io.github.cdagaming.unicore.utils.TimeUtils; -import net.minecraft.src.*; +import net.minecraft.client.gui.GuiConnecting; +import net.minecraft.client.net.handler.NetClientHandler; +import net.minecraft.core.net.NetworkManager; import java.net.Socket; import java.util.List; @@ -586,9 +588,9 @@ private void joinServer(final ServerNBTStorage serverData) { @Override public void initPresence() { // Player Position Arguments - syncArgument("player.position.x", () -> MathUtils.roundDouble(CraftPresence.player.posX, 3)); - syncArgument("player.position.y", () -> MathUtils.roundDouble(CraftPresence.player.posY, 3)); - syncArgument("player.position.z", () -> MathUtils.roundDouble(CraftPresence.player.posZ, 3)); + syncArgument("player.position.x", () -> MathUtils.roundDouble(CraftPresence.player.x, 3)); + syncArgument("player.position.y", () -> MathUtils.roundDouble(CraftPresence.player.y, 3)); + syncArgument("player.position.z", () -> MathUtils.roundDouble(CraftPresence.player.z, 3)); // Player Health Arguments syncArgument("player.health.current", () -> MathUtils.roundDouble(CraftPresence.player.health, 0)); @@ -607,7 +609,7 @@ public void initPresence() { return StringUtils.getOrDefault(newWeatherName); }); syncArgument("world.name", () -> { - final String primaryWorldName = CraftPresence.world.getWorldInfo().getWorldName(); + final String primaryWorldName = CraftPresence.world.getLevelData().getWorldName(); final String secondaryWorldName = Constants.TRANSLATOR.translate("craftpresence.defaults.world_name"); final String newWorldName = StringUtils.getOrDefault(primaryWorldName, secondaryWorldName); return StringUtils.getOrDefault(newWorldName); diff --git a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/world/BiomeUtils.java b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/world/BiomeUtils.java index 8d31c5e757..a4cd3e72de 100644 --- a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/world/BiomeUtils.java +++ b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/world/BiomeUtils.java @@ -28,11 +28,10 @@ import com.gitlab.cdagaming.craftpresence.core.config.Config; import com.gitlab.cdagaming.craftpresence.core.config.element.ModuleData; import com.gitlab.cdagaming.craftpresence.core.impl.ExtendedModule; -import io.github.cdagaming.unicore.utils.FileUtils; import io.github.cdagaming.unicore.utils.MappingUtils; import io.github.cdagaming.unicore.utils.StringUtils; -import net.minecraft.src.BiomeGenBase; -import unilib.external.io.github.classgraph.ClassInfo; +import net.minecraft.core.data.registry.Registries; +import net.minecraft.core.world.biome.Biome; import java.util.List; import java.util.function.Supplier; @@ -91,7 +90,7 @@ public class BiomeUtils implements ExtendedModule { /** * The Player's Current Biome, if any */ - private BiomeGenBase CURRENT_BIOME; + private Biome CURRENT_BIOME; @Override public void clearFieldData() { @@ -114,8 +113,8 @@ public void clearAttributes() { @Override public void updateData() { - final BiomeGenBase newBiome = CraftPresence.world.getWorldChunkManager().getBiomeGenAt((int) CraftPresence.player.posX, (int) CraftPresence.player.posZ); - final String newBiomeName = newBiome.biomeName; + final Biome newBiome = CraftPresence.world.getBlockBiome((int) CraftPresence.player.x, (int) CraftPresence.player.y, (int) CraftPresence.player.z); + final String newBiomeName = Registries.BIOMES.getKey(newBiome); final String newBiomeIdentifier = StringUtils.getOrDefault(newBiomeName, MappingUtils.getClassName(newBiome)); @@ -183,36 +182,15 @@ public void updatePresence() { * * @return The detected Biome Types found */ - private List getBiomeTypes() { - List biomeTypes = StringUtils.newArrayList(); - - if (biomeTypes.isEmpty()) { - // Fallback: Use Manual Class Lookup - for (ClassInfo classInfo : FileUtils.getClassNamesMatchingSuperType(BiomeGenBase.class).values()) { - if (classInfo != null) { - try { - Class classObj = FileUtils.loadClass(classInfo.getName()); - if (classObj != null) { - BiomeGenBase biomeObj = (BiomeGenBase) classObj.getDeclaredConstructor().newInstance(); - if (!biomeTypes.contains(biomeObj)) { - biomeTypes.add(biomeObj); - } - } - } catch (Throwable ex) { - printException(ex); - } - } - } - } - - return biomeTypes; + private List getBiomeTypes() { + return StringUtils.newArrayList(Registries.BIOMES.iterator()); } @Override public void getInternalData() { - for (BiomeGenBase biome : getBiomeTypes()) { + for (Biome biome : getBiomeTypes()) { if (biome != null) { - String biomeName = StringUtils.getOrDefault(biome.biomeName, MappingUtils.getClassName(biome)); + String biomeName = StringUtils.getOrDefault(Registries.BIOMES.getKey(biome), MappingUtils.getClassName(biome)); String name = StringUtils.formatIdentifier(biomeName, true, !CraftPresence.CONFIG.advancedSettings.formatWords); if (!DEFAULT_NAMES.contains(name)) { DEFAULT_NAMES.add(name); @@ -251,11 +229,6 @@ public String getOverrideText(ModuleData data) { return CraftPresence.CLIENT.getOverrideText(getPresenceData(data)); } - @Override - public boolean canFetchInternals() { - return MappingUtils.areMappingsLoaded() && FileUtils.isClassGraphEnabled() && FileUtils.canScanClasses(); - } - @Override public boolean hasScannedInternals() { return hasScannedInternals; diff --git a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/world/DimensionUtils.java b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/world/DimensionUtils.java index 289087478f..9b3156bd45 100644 --- a/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/world/DimensionUtils.java +++ b/common/src/main/java/com/gitlab/cdagaming/craftpresence/utils/world/DimensionUtils.java @@ -28,11 +28,10 @@ import com.gitlab.cdagaming.craftpresence.core.config.Config; import com.gitlab.cdagaming.craftpresence.core.config.element.ModuleData; import com.gitlab.cdagaming.craftpresence.core.impl.ExtendedModule; -import io.github.cdagaming.unicore.utils.FileUtils; import io.github.cdagaming.unicore.utils.MappingUtils; import io.github.cdagaming.unicore.utils.StringUtils; -import net.minecraft.src.WorldProvider; -import unilib.external.io.github.classgraph.ClassInfo; +import net.minecraft.core.data.registry.Registries; +import net.minecraft.core.world.type.WorldType; import java.util.List; import java.util.function.Supplier; @@ -91,7 +90,7 @@ public class DimensionUtils implements ExtendedModule { /** * The Player's Current Dimension, if any */ - private WorldProvider CURRENT_DIMENSION; + private WorldType CURRENT_DIMENSION; @Override public void clearFieldData() { @@ -114,10 +113,10 @@ public void clearAttributes() { @Override public void updateData() { - final WorldProvider newProvider = CraftPresence.world.worldProvider; - final String newDimensionName = MappingUtils.getClassName(newProvider); + final WorldType newProvider = CraftPresence.world.getWorldType(); + final String newDimensionName = Registries.WORLD_TYPES.getKey(newProvider); - final String newDimensionIdentifier = newDimensionName; + final String newDimensionIdentifier = StringUtils.getOrDefault(newDimensionName, MappingUtils.getClassName(newProvider)); if (!newDimensionName.equals(RAW_DIMENSION_NAME) || !newDimensionIdentifier.equals(RAW_DIMENSION_IDENTIFIER)) { CURRENT_DIMENSION = newProvider; @@ -183,36 +182,15 @@ public void updatePresence() { * * @return The detected Dimension Types found */ - private List getDimensionTypes() { - List dimensionTypes = StringUtils.newArrayList(); - - if (dimensionTypes.isEmpty()) { - // Use Manual Class Lookup - for (ClassInfo classInfo : FileUtils.getClassNamesMatchingSuperType(WorldProvider.class).values()) { - if (classInfo != null) { - try { - Class classObj = FileUtils.loadClass(classInfo.getName()); - if (classObj != null) { - WorldProvider providerObj = (WorldProvider) classObj.getDeclaredConstructor().newInstance(); - if (!dimensionTypes.contains(providerObj)) { - dimensionTypes.add(providerObj); - } - } - } catch (Throwable ex) { - printException(ex); - } - } - } - } - - return dimensionTypes; + private List getDimensionTypes() { + return StringUtils.newArrayList(Registries.WORLD_TYPES.iterator()); } @Override public void getInternalData() { - for (WorldProvider TYPE : getDimensionTypes()) { - if (TYPE != null) { - String dimensionName = MappingUtils.getClassName(TYPE); + for (WorldType data : getDimensionTypes()) { + if (data != null) { + String dimensionName = Registries.WORLD_TYPES.getKey(data); String name = StringUtils.formatIdentifier(dimensionName, true, !CraftPresence.CONFIG.advancedSettings.formatWords); if (!DEFAULT_NAMES.contains(name)) { DEFAULT_NAMES.add(name); @@ -251,11 +229,6 @@ public String getOverrideText(ModuleData data) { return CraftPresence.CLIENT.getOverrideText(getPresenceData(data)); } - @Override - public boolean canFetchInternals() { - return MappingUtils.areMappingsLoaded() && FileUtils.isClassGraphEnabled() && FileUtils.canScanClasses(); - } - @Override public boolean hasScannedInternals() { return hasScannedInternals; diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 0adf4f6503..6b76253dc7 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -1,6 +1,3 @@ -import xyz.wagyourtail.unimined.api.minecraft.patch.fabric.FabricLikePatcher -import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask - /** * Retrieve a Project Property */ @@ -25,22 +22,7 @@ val mcVersionLabel: String by extra val baseVersionLabel: String by extra unimined.minecraft { - val fabricData: FabricLikePatcher.() -> Unit = { - if (accessWidenerFile.exists()) { - accessWidener(accessWidenerFile) - } - loader("fabric_loader_version"()!!) - if (isJarMod) { - prodNamespace("official") - devMappings = null - } - customIntermediaries = true - } - if (isModern) { - fabric(fabricData) - } else { - legacyFabric(fabricData) - } + // N/A } val common: Configuration by configurations.creating @@ -50,6 +32,8 @@ configurations.compileClasspath.get().extendsFrom(common) configurations.runtimeClasspath.get().extendsFrom(common) dependencies { + "jarMod"("local:nsss:${"forge_version"()}") + // Fabric Integrations (1.14+) if (isModern) { // Required for loading translation data @@ -94,17 +78,9 @@ tasks.shadowJar { dependsOn(project(":common").tasks.shadowJar) from(zipTree(project(":common").tasks.shadowJar.get().archiveFile)) configurations = listOf(shadowCommon) - archiveClassifier.set("dev-shadow") -} - -tasks.named("remapJar") { - if (isJarMod) { - prodNamespace("official") - } - inputFile.set(tasks.shadowJar.get().archiveFile) - dependsOn(tasks.shadowJar.get()) archiveClassifier.set(project.name) } +tasks.build.get().dependsOn(tasks.shadowJar.get()) tasks.jar { archiveClassifier.set("dev") diff --git a/gradle.properties b/gradle.properties index e9d7710772..aab2aa4003 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false # Archive Info -mod_name=CraftPresence +mod_name=CraftPresence-BTA mod_id=craftpresence group=com.gitlab.cdagaming -enabled_platforms=fabric,modloader +enabled_platforms=fabric # Critical Info isLegacy=true isJarMod=true @@ -15,20 +15,20 @@ mc_mappings=4.3-b1.7.3 mc_mappings_type=mcp mc_version=b1.7.3 mc_protocol=14 -display_version= +display_version=b1.7.7.0_02 # Fabric Info fabric_loader_version=0.16.5 fabric_api_version= fabric_game_version_range=* fabric_loader_version_range=>=0.13.0 # Forge Info -forge_version=b1.7.3 +forge_version=1.7.7.0_02 fml_version_range= forge_game_version_range=b1.7.3 forge_loader_version_range= # Deployment Info versionId=2.5.1 -deploymentType=Release +deploymentType=Alpha versionLabel=Release additional_mc_versions= # Integration Info @@ -41,7 +41,7 @@ starscript_version=0.3.4 classgraph_version=4.8.177 moonconf_version=1.0.9 # UniLib Info -unilib_name=UniLib +unilib_name=UniLib-BTA unilib_build_version=1.0.3 unilib_minimum_version=1.0.1 # Dependency Info diff --git a/libs/nsss-1.7.7.0_02.jar b/libs/nsss-1.7.7.0_02.jar new file mode 100644 index 0000000000..f3dc5ca86e Binary files /dev/null and b/libs/nsss-1.7.7.0_02.jar differ