diff --git a/.gitignore b/.gitignore index d66530a0..6dcb2227 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,5 @@ bin/ run/ .fabric + +*.old \ No newline at end of file diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 2505273c..00000000 --- a/build.gradle +++ /dev/null @@ -1,138 +0,0 @@ -plugins { - id 'dev.architectury.loom' version '1.6-SNAPSHOT' apply(false) - id 'me.fallenbreath.yamlang' version '1.3.1' apply(false) - id "me.modmuss50.mod-publish-plugin" version "0.4.4" apply(false) - id 'maven-publish' -} - -version = "${mod_version}+${minecraft_version}" - -subprojects { - apply plugin: 'java' - apply plugin: 'dev.architectury.loom' - apply plugin: 'me.fallenbreath.yamlang' - apply plugin: "me.modmuss50.mod-publish-plugin" - apply plugin: 'maven-publish' - - version = "${mod_version}+${minecraft_version}" - - repositories { - // Personal maven for cicada and backup mirrors of some dependencies. - maven { url "https://maven.enjarai.dev/mirrors" } - maven { url "https://maven.enjarai.dev/releases" } - - // NeoForge - maven { url 'https://maven.neoforged.net/releases/' } - - // Mod Menu. - maven { url 'https://maven.terraformersmc.com' } - - // Cloth Config. - maven { url "https://maven.shedaniel.me/" } - maven { url "https://maven.terraformersmc.com/releases/" } - - // Jitpack for Mixin Extras. - maven { - url 'https://jitpack.io' - content { - includeGroup 'com.github.llamalad7' - } - } - - // YACL/Controlify - maven { url "https://maven.isxander.dev/releases" } - maven { url "https://maven.quiltmc.org/repository/release/" } - - // Mod Menu - maven { url "https://maven.terraformersmc.com/releases" } - - // Permissions API - maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } - } - - java { - toolchain.languageVersion = JavaLanguageVersion.of(21) - withSourcesJar() - withJavadocJar() - } - - jar { - from(rootProject.file("LICENSE")) { - rename { "${it}_${mod_name}" } - } - manifest { - attributes([ - 'Specification-Title' : mod_name, - 'Specification-Vendor' : mod_author, - 'Specification-Version' : project.jar.archiveVersion, - 'Implementation-Title' : project.name, - 'Implementation-Version' : project.jar.archiveVersion, - 'Implementation-Vendor' : mod_author, - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - 'Timestamp' : System.currentTimeMillis(), - 'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", - 'Built-On-Minecraft' : minecraft_version - ]) - } - } - - sourcesJar { - from(rootProject.file("LICENSE")) { - rename { "${it}_${mod_name}" } - } - } - - tasks.withType(JavaCompile).configureEach { - it.options.encoding = 'UTF-8' - it.options.getRelease().set(21) - } - - plugins.withId('dev.architectury.loom') { - loom { - accessWidenerPath = project(":common").file("src/main/resources/${mod_id}.accesswidener") - } - } - - processResources { - var replaceProperties = [ - minecraft_version : minecraft_version, - - forge_minecraft_version_range : forge_minecraft_version_range, - forge_version : forge_version, - forge_version_range : forge_version_range, - loader_version_range : loader_version_range, - - fabric_minecraft_version_range: fabric_minecraft_version_range, - - fabric_version : fabric_version, - fabric_loader_version : fabric_loader_version, - - mod_id : mod_id, - mod_name : mod_name, - mod_version : version, // findProperty('mod_version') ?: project.jar.archiveVersion, - mod_license : mod_license, - mod_author : mod_author, - mod_credits : mod_credits, - mod_description : mod_description, - mod_url : mod_url, - mod_github : mod_github, - mod_issue_tracker_url : mod_issue_tracker_url, - ] - inputs.properties replaceProperties - filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', '*.mixins.json']) { - expand replaceProperties - } - } - - // Disables Gradle's custom module metadata from being published to maven. The - // metadata includes mapped dependencies which are not reasonably consumable by - // other mod developers. - tasks.withType(GenerateModuleMetadata).configureEach { - enabled = false - } - - yamlang { - targetSourceSets = [sourceSets.main] - inputDir = "assets/${mod_id}/lang" - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..76c34153 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,258 @@ +plugins { + `maven-publish` + id("dev.architectury.loom") + id("me.modmuss50.mod-publish-plugin") + id("me.fallenbreath.yamlang") version "1.3.1" +} + +// Variables +class ModData { + val id = property("mod.id").toString() + val name = property("mod.name").toString() + val version = property("mod.version").toString() + val group = property("mod.group").toString() +} + +val mod = ModData() + +val loader = loom.platform.get().name.lowercase() +val isFabric = loader == "fabric" +val mcVersion = stonecutter.current.project.substringBeforeLast('-') +val mcDep = property("mod.mc_dep").toString() +val isSnapshot = hasProperty("env.snapshot") + +version = "${mod.version}+$mcVersion" +group = mod.group +base { archivesName.set("${mod.id}-$loader") } + +// Dependencies +repositories { + fun strictMaven(url: String, vararg groups: String) = exclusiveContent { + forRepository { maven(url) } + filter { groups.forEach(::includeGroup) } + } + strictMaven("https://api.modrinth.com/maven", "maven.modrinth") + maven("https://maven.enjarai.dev/releases") + maven("https://maven.enjarai.dev/mirrors") + maven("https://jitpack.io") + maven("https://maven.neoforged.net/releases/") + maven("https://maven.terraformersmc.com/releases/") + maven("https://maven.bawnorton.com/releases/") + maven("https://oss.sonatype.org/content/repositories/snapshots") + maven("https://maven.su5ed.dev/releases") +} + +dependencies { + fun modrinth(name: String, dep: Any?) = "maven.modrinth:$name:$dep" + + fun ifStable(str: String, action: (String) -> Unit = { modImplementation(it) }) { + if (isSnapshot) modCompileOnly(str) else action(str) + } + + minecraft("com.mojang:minecraft:${mcVersion}") + @Suppress("UnstableApiUsage") + mappings(loom.layered { + mappings("net.fabricmc:yarn:${mcVersion}+build.${property("deps.yarn_build")}:v2") + if (stonecutter.eval(mcVersion, "1.20.6")) + mappings("dev.architectury:yarn-mappings-patch-neoforge:1.20.5+build.3") + else if (stonecutter.eval(mcVersion, "1.21")) + mappings("dev.architectury:yarn-mappings-patch-neoforge:1.21+build.4") + }) + val mixinExtras = "io.github.llamalad7:mixinextras-%s:${property("deps.mixin_extras")}" + val mixinSquared = "com.github.bawnorton.mixinsquared:mixinsquared-%s:${property("deps.mixin_squared")}" + implementation(annotationProcessor(mixinSquared.format("common"))!!) + + modCompileOnly("dev.isxander:yet-another-config-lib:${property("deps.yacl")}-$loader") + + if (isFabric) { + modImplementation("net.fabricmc.fabric-api:fabric-api:${property("deps.fapi")}") + modImplementation("net.fabricmc:fabric-loader:${property("deps.fabric_loader")}") + include(implementation(mixinSquared.format("fabric"))!!) + ifStable("com.terraformersmc:modmenu:${property("deps.modmenu")}") + + modApi("nl.enjarai:cicada-lib:${property("deps.cicada")}") + include(modImplementation("me.lucko:fabric-permissions-api:${property("deps.perm_api")}")!!) + + modRuntimeOnly("dev.isxander:yet-another-config-lib:${property("deps.yacl")}-$loader") + } else { + if (loader == "forge") { + "forge"("net.minecraftforge:forge:${mcVersion}-${property("deps.fml")}") + compileOnly(annotationProcessor(mixinExtras.format("common"))!!) + include(implementation(mixinExtras.format("forge"))!!) + } else + "neoForge"("net.neoforged:neoforge:${property("deps.fml")}") + include(implementation(mixinSquared.format(loader))!!) + modImplementation("org.sinytra.forgified-fabric-api:forgified-fabric-api:${property("deps.fapi")}") + } + // Config + + // Compat + for (it in property("deps.compat").toString().split(',')) { + @Suppress("UselessCallOnNotNull") + if (it.isNullOrBlank()) continue + val (modid, version) = it.split('=') + modCompileOnly(modrinth(modid, version)) + } +} + +// Loom config +loom { + accessWidenerPath.set(rootProject.file("src/main/resources/do_a_barrel_roll.accesswidener")) + + if (loader == "forge") forge { + convertAccessWideners.set(true) + mixinConfigs( + "${mod.id}-client.mixins.json", + "${mod.id}-common.mixins.json", + "${mod.id}-compat.mixins.json" + ) + } else if (loader == "neoforge") neoForge { + + } + + runConfigs.all { + ideConfigGenerated(true) + vmArgs("-Dmixin.debug.export=true") + runDir = "../../run" + if (environment == "client") programArgs("--username=enjarai") // No, its me now :3 + } + + decompilers { + get("vineflower").apply { + options.put("mark-corresponding-synthetics", "1") + } + } +} + +// Tasks +val buildAndCollect = tasks.register("buildAndCollect") { + group = "build" + from(tasks.remapJar.get().archiveFile) + into(rootProject.layout.buildDirectory.file("libs/${mod.version}")) + dependsOn("build") +} + +val publishAll = tasks.register("publishAll") { + group = "publishing" + dependsOn("publish") + dependsOn("publishMods") +} + +if (stonecutter.current.isActive) { + rootProject.tasks.register("buildActive") { + group = "project" + dependsOn(buildAndCollect) + } + + rootProject.tasks.register("runActive") { + group = "project" + dependsOn(tasks.named("runClient")) + } +} + +// Resources +tasks.processResources { + inputs.property("version", mod.version) + inputs.property("mc", mcDep) + + val map = mapOf( + "version" to mod.version, + "mc" to mcDep, + "fml" to if (loader == "neoforge") "1" else "45", + ) + + filesMatching("fabric.mod.json") { expand(map) } + filesMatching("META-INF/mods.toml") { expand(map) } + filesMatching("META-INF/neoforge.mods.toml") { expand(map) } +} + +yamlang { + targetSourceSets.set(mutableListOf(sourceSets["main"])) + inputDir.set("assets/${mod.id}/lang") +} + +// Env configuration +stonecutter { + val j21 = eval(mcVersion, ">=1.20.6") + java { + withSourcesJar() + sourceCompatibility = if (j21) JavaVersion.VERSION_21 else JavaVersion.VERSION_17 + targetCompatibility = if (j21) JavaVersion.VERSION_21 else JavaVersion.VERSION_17 + } +} + +// Publishing +publishMods { + val modrinthToken = findProperty("enjaraiModrinthToken") + val curseforgeToken = findProperty("enjaraiCurseforgeToken") + val githubToken = findProperty("enjaraiGithubToken tTEST") + dryRun = modrinthToken == null || curseforgeToken == null || githubToken == null + + file = tasks.remapJar.get().archiveFile + additionalFiles.from(tasks.remapSourcesJar.get().archiveFile) + displayName = + "${mod.version} for ${loader.replaceFirstChar { it.uppercase() }} ${property("mod.mc_title")}" + version = "${project.version}-$loader" + changelog = rootProject.file("CHANGELOG.md").readText() + type = STABLE + modLoaders.add(loader) + + val targets = property("mod.mc_targets").toString().split(' ') + modrinth { + projectId = property("publish.modrinth").toString() + accessToken = modrinthToken.toString() + targets.forEach(minecraftVersions::add) + + if (isFabric) { + requires("fabric-api", "cicada") + embeds("cardinal-components-api") + } else { + requires("forgified-fabric-api") + } + optional("yacl") + } + + curseforge { + projectId = property("publish.curseforge").toString() + accessToken = curseforgeToken.toString() + targets.forEach(minecraftVersions::add) + + if (isFabric) { + requires("fabric-api", "cicada") + embeds("cardinal-components-api") + } else { + requires("forgified-fabric-api") + } + optional("yacl") + } + + github { + repository = property("publish.github").toString() + accessToken = githubToken.toString() + + commitish = property("publish.branch").toString() + tagName = "${project.version}-$loader" + } +} + +publishing { + repositories { + maven("https://maven.enjarai.dev/releases") { + name = "enjaraiMaven" + credentials(PasswordCredentials::class.java) + authentication { + create("basic") + } + } + } + + publications { + create("mavenJava") { + groupId = property("mod.group").toString() + artifactId = "do-a-barrel-roll" + version = "$version-$loader" + + from(components["java"]) + } + } +} \ No newline at end of file diff --git a/common/build.gradle b/common/build.gradle deleted file mode 100644 index 80ac99ac..00000000 --- a/common/build.gradle +++ /dev/null @@ -1,41 +0,0 @@ -base { - archivesName = "${mod_id}-common" -} - -dependencies { - minecraft "com.mojang:minecraft:${minecraft_version}" - mappings "net.fabricmc:yarn:${yarn_version}:v2" - - modCompileOnly "net.fabricmc:fabric-loader:${fabric_loader_version}" - - modImplementation("dev.isxander:yet-another-config-lib:${project.yacl_version}-fabric") { - exclude group: "net.fabricmc" - } - - compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${project.mixin_extras_version}")) - - implementation(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-fabric:${project.mixin_squared_version}")) -} - -publishing { - repositories { - maven { - name = "enjaraiMaven" - url = "https://maven.enjarai.dev/releases" - credentials(PasswordCredentials) - authentication { - basic(BasicAuthentication) - } - } - } - - publications { - mavenJava(MavenPublication) { - groupId = rootProject.property('group') - artifactId = "do-a-barrel-roll" - version = "${project.version}-common" - - from components.java - } - } -} \ No newline at end of file diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRoll.java b/common/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRoll.java deleted file mode 100644 index 8377071b..00000000 --- a/common/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRoll.java +++ /dev/null @@ -1,30 +0,0 @@ -package nl.enjarai.doabarrelroll; - -import io.netty.buffer.Unpooled; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.util.Identifier; -import nl.enjarai.doabarrelroll.platform.Services; -import org.slf4j.Logger; - -import java.nio.file.Path; - -public class DoABarrelRoll { - public static final String MODID = "do_a_barrel_roll"; - public static final Logger LOGGER = Services.PLATFORM.getLogger(); - - public static final Identifier HANDSHAKE_CHANNEL = id("handshake"); - public static final Identifier SERVER_CONFIG_UPDATE_CHANNEL = id("server_config_update"); - public static final Identifier ROLL_CHANNEL = id("player_roll"); - - public static Identifier id(String path) { - return Identifier.of(MODID, path); - } - - public static void init() { - var configFile = Path.of("config"); - } - - public static PacketByteBuf createBuf() { - return new PacketByteBuf(Unpooled.buffer()); - } -} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/compat/Compat.java b/common/src/main/java/nl/enjarai/doabarrelroll/compat/Compat.java deleted file mode 100644 index b8e67b9e..00000000 --- a/common/src/main/java/nl/enjarai/doabarrelroll/compat/Compat.java +++ /dev/null @@ -1,15 +0,0 @@ -package nl.enjarai.doabarrelroll.compat; - -import nl.enjarai.doabarrelroll.platform.Services; - -public class Compat { - public static final String YACL_MIN_VERSION = "3.1.0"; - - public static boolean isYACLLoaded() { - return Services.PLATFORM.checkModLoaded("yet_another_config_lib_v3"); - } - - public static boolean isYACLUpToDate() { - return Services.PLATFORM.isModVersionAtLeast("yet_another_config_lib_v3", YACL_MIN_VERSION); - } -} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigResponseC2SPacket.java b/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigResponseC2SPacket.java deleted file mode 100644 index 51a8162a..00000000 --- a/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigResponseC2SPacket.java +++ /dev/null @@ -1,7 +0,0 @@ -package nl.enjarai.doabarrelroll.net.packet; - -public interface ConfigResponseC2SPacket { - int protocolVersion(); - - boolean success(); -} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigSyncS2CPacket.java b/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigSyncS2CPacket.java deleted file mode 100644 index db39432f..00000000 --- a/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigSyncS2CPacket.java +++ /dev/null @@ -1,15 +0,0 @@ -package nl.enjarai.doabarrelroll.net.packet; - -import nl.enjarai.doabarrelroll.config.LimitedModConfigServer; -import nl.enjarai.doabarrelroll.config.ModConfigServer; -import org.jetbrains.annotations.Nullable; - -public interface ConfigSyncS2CPacket { - int protocolVersion(); - - LimitedModConfigServer applicableConfig(); - - boolean isLimited(); - - ModConfigServer fullConfig(); -} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateAckS2CPacket.java b/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateAckS2CPacket.java deleted file mode 100644 index 1da38f38..00000000 --- a/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateAckS2CPacket.java +++ /dev/null @@ -1,7 +0,0 @@ -package nl.enjarai.doabarrelroll.net.packet; - -public interface ConfigUpdateAckS2CPacket { - int protocolVersion(); - - boolean success(); -} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateC2SPacket.java b/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateC2SPacket.java deleted file mode 100644 index c8513ce1..00000000 --- a/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateC2SPacket.java +++ /dev/null @@ -1,9 +0,0 @@ -package nl.enjarai.doabarrelroll.net.packet; - -import nl.enjarai.doabarrelroll.config.ModConfigServer; - -public interface ConfigUpdateC2SPacket { - int protocolVersion(); - - ModConfigServer config(); -} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncC2SPacket.java b/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncC2SPacket.java deleted file mode 100644 index 676f2a41..00000000 --- a/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncC2SPacket.java +++ /dev/null @@ -1,7 +0,0 @@ -package nl.enjarai.doabarrelroll.net.packet; - -public interface RollSyncC2SPacket { - boolean rolling(); - - float roll(); -} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncS2CPacket.java b/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncS2CPacket.java deleted file mode 100644 index 2f212f00..00000000 --- a/common/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncS2CPacket.java +++ /dev/null @@ -1,9 +0,0 @@ -package nl.enjarai.doabarrelroll.net.packet; - -public interface RollSyncS2CPacket { - int entityId(); - - boolean rolling(); - - float roll(); -} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/platform/Services.java b/common/src/main/java/nl/enjarai/doabarrelroll/platform/Services.java deleted file mode 100644 index 7fd2edc0..00000000 --- a/common/src/main/java/nl/enjarai/doabarrelroll/platform/Services.java +++ /dev/null @@ -1,29 +0,0 @@ -package nl.enjarai.doabarrelroll.platform; - -import nl.enjarai.doabarrelroll.platform.services.ClientNetworkUtils; -import nl.enjarai.doabarrelroll.platform.services.PlatformHelper; -import nl.enjarai.doabarrelroll.platform.services.ServerNetworkUtils; - -import java.util.ServiceLoader; - -// Service loaders are a built-in Java feature that allow us to locate implementations of an interface that vary from one -// environment to another. In the context of MultiLoader we use this feature to access a mock API in the common code that -// is swapped out for the platform specific implementation at runtime. -public class Services { - // In this example we provide a platform helper which provides information about what platform the mod is running on. - // For example this can be used to check if the code is running on Forge vs Fabric, or to ask the modloader if another - // mod is loaded. - public static final PlatformHelper PLATFORM = load(PlatformHelper.class); - public static final ServerNetworkUtils SERVER_NET = load(ServerNetworkUtils.class); - public static final ClientNetworkUtils CLIENT_NET = load(ClientNetworkUtils.class); - - // This code is used to load a service for the current environment. Your implementation of the service must be defined - // manually by including a text file in META-INF/services named with the fully qualified class name of the service. - // Inside the file you should write the fully qualified class name of the implementation to load for the platform. For - // example our file on Forge points to ForgePlatformHelper while Fabric points to FabricPlatformHelper. - public static T load(Class clazz) { - return ServiceLoader.load(clazz) - .findFirst() - .orElseThrow(() -> new NullPointerException("Failed to load service for " + clazz.getName())); - } -} \ No newline at end of file diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/platform/services/ClientNetworkUtils.java b/common/src/main/java/nl/enjarai/doabarrelroll/platform/services/ClientNetworkUtils.java deleted file mode 100644 index 83bc56df..00000000 --- a/common/src/main/java/nl/enjarai/doabarrelroll/platform/services/ClientNetworkUtils.java +++ /dev/null @@ -1,13 +0,0 @@ -package nl.enjarai.doabarrelroll.platform.services; - -import nl.enjarai.doabarrelroll.api.RollEntity; -import nl.enjarai.doabarrelroll.config.ModConfigServer; -import nl.enjarai.doabarrelroll.net.HandshakeClient; - -public interface ClientNetworkUtils { - void sendRollUpdate(RollEntity entity); - - void sendConfigUpdatePacket(ModConfigServer config); - - HandshakeClient getHandshakeClient(); -} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/platform/services/PlatformHelper.java b/common/src/main/java/nl/enjarai/doabarrelroll/platform/services/PlatformHelper.java deleted file mode 100644 index e98db21d..00000000 --- a/common/src/main/java/nl/enjarai/doabarrelroll/platform/services/PlatformHelper.java +++ /dev/null @@ -1,27 +0,0 @@ -package nl.enjarai.doabarrelroll.platform.services; - -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.server.network.ServerPlayNetworkHandler; -import net.minecraft.util.Identifier; -import org.slf4j.Logger; - -public interface PlatformHelper { - /** - * Gets the name of the current platform - * - * @return The name of the current platform. - */ - String getPlatformName(); - - Logger getLogger(); - - boolean checkPermission(ServerPlayNetworkHandler source, String permission, int defaultPermissionLevel); - - void registerNetworkChannels(Identifier... channels); - - void notMyProblem(Screen ConfigScreen, Runnable callback); - - boolean checkModLoaded(String modId); - - boolean isModVersionAtLeast(String modId, String version); -} \ No newline at end of file diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/platform/services/ServerNetworkUtils.java b/common/src/main/java/nl/enjarai/doabarrelroll/platform/services/ServerNetworkUtils.java deleted file mode 100644 index 90ddf4bd..00000000 --- a/common/src/main/java/nl/enjarai/doabarrelroll/platform/services/ServerNetworkUtils.java +++ /dev/null @@ -1,17 +0,0 @@ -package nl.enjarai.doabarrelroll.platform.services; - -import net.minecraft.entity.Entity; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.server.network.ServerPlayNetworkHandler; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.Identifier; -import nl.enjarai.doabarrelroll.net.ServerConfigHolder; - -import java.util.function.Consumer; -import java.util.function.Predicate; - -public interface ServerNetworkUtils { - void sendRollUpdates(Entity entity); - - ServerConfigHolder getServerConfigHolder(); -} diff --git a/fabric/build.gradle b/fabric/build.gradle deleted file mode 100644 index 1000ff69..00000000 --- a/fabric/build.gradle +++ /dev/null @@ -1,169 +0,0 @@ -base { - archivesName = "${mod_id}-fabric" -} - -dependencies { - minecraft "com.mojang:minecraft:${minecraft_version}" - mappings "net.fabricmc:yarn:${yarn_version}:v2" - modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" - modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}" - implementation project(path: ":common", configuration: "namedElements") - - modImplementation("nl.enjarai:cicada-lib:${project.cicada_version}") { - exclude group: "net.fabricmc.fabric-api" - } - - modImplementation("dev.isxander:yet-another-config-lib:${project.yacl_version}-fabric") { - exclude group: "net.fabricmc" - } - - modCompileOnly("dev.isxander:controlify:${project.controlify_version}-fabric") { - exclude group: "net.fabricmc" - exclude group: "maven.modrinth" - exclude group: "com.github.CaffeineMC" - exclude group: "me.flashyreese.mods" - } - - // Mod Menu integration. - modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}" - - implementation(include("com.github.bawnorton.mixinsquared:mixinsquared-fabric:${project.mixin_squared_version}")) - - include(modImplementation("me.lucko:fabric-permissions-api:${project.permissions_api_version}")) -} - -loom { - if (project(":common").file("src/main/resources/${mod_id}.accesswidener").exists()) { - accessWidenerPath.set(project(":common").file("src/main/resources/${mod_id}.accesswidener")) - } - mixin { - defaultRefmapName.set("${mod_id}.refmap.json") - } - runs { - client { - client() - setConfigName("Fabric Client") - ideConfigGenerated(true) - runDir("run") - } - server { - server() - setConfigName("Fabric Server") - ideConfigGenerated(true) - runDir("run") - } - } -} - -sourceSets.main.resources.srcDir 'src/main/generated' - -tasks.withType(JavaCompile).configureEach { - source(project(":common").sourceSets.main.allSource) -} -tasks.withType(Javadoc).configureEach { - source(project(":common").sourceSets.main.allJava) -} -tasks.named("sourcesJar", Jar) { - from(project(":common").sourceSets.main.allSource) -} - -processResources { - from project(":common").sourceSets.main.resources -} - -publishing { - repositories { - maven { - name = "enjaraiMaven" - url = "https://maven.enjarai.dev/releases" - credentials(PasswordCredentials) - authentication { - basic(BasicAuthentication) - } - } - } - - publications { - mavenJava(MavenPublication) { - groupId = rootProject.property('group') - artifactId = "do-a-barrel-roll" - version = "${project.version}-fabric" - - from components.java - } - } -} - -publishMods { - file = remapJar.archiveFile - displayName = "${property('mod_version')} for Fabric ${property('minecraft_version')}" - version = "${project.version}-fabric" - changelog = getRootProject().file("CHANGELOG.md").text - type = STABLE - modLoaders.add("fabric") - - def min = property('publish_target_min') - def max = property('publish_target_max') - - if (providers.gradleProperty('enjaraiModrinthToken').present) { - modrinth { - projectId = property('mod_modrinth') - accessToken = providers.gradleProperty('enjaraiModrinthToken').get() - - if (min == max) { - minecraftVersions.add(min) - } else { - minecraftVersionRange { - start = min - end = max - } - } - - requires { - slug = "fabric-api" - } - embeds { - slug = "cardinal-components-api" - } - requires { - slug = "cicada" - } - } - } - - if (providers.gradleProperty('enjaraiCurseforgeToken').present) { - curseforge { - projectId = property('mod_curseforge') - accessToken = providers.gradleProperty('enjaraiCurseforgeToken').get() - - if (min == max) { - minecraftVersions.add(min) - } else { - minecraftVersionRange { - start = min - end = max - } - } - - requires { - slug = "fabric-api" - } - embeds { - slug = "cardinal-components-api" - } - requires { - slug = "cicada" - } - } - } - - if (providers.gradleProperty('enjaraiGithubToken').present) { - github { - repository = property('mod_github') - accessToken = providers.gradleProperty('enjaraiGithubToken').get() - - commitish = property('git_branch') - tagName = "${project.version}-fabric" - } - } -} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollFabric.java b/fabric/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollFabric.java deleted file mode 100644 index db6b19de..00000000 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollFabric.java +++ /dev/null @@ -1,16 +0,0 @@ -package nl.enjarai.doabarrelroll; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; -import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; -import nl.enjarai.doabarrelroll.net.ServerNetworking; - -public class DoABarrelRollFabric implements ModInitializer { - @Override - public void onInitialize() { - // Init server and client common code. - DoABarrelRoll.init(); - - ServerNetworking.init(); - } -} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollFabricClient.java b/fabric/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollFabricClient.java deleted file mode 100644 index e5260e12..00000000 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollFabricClient.java +++ /dev/null @@ -1,21 +0,0 @@ -package nl.enjarai.doabarrelroll; - -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; -import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; -import nl.enjarai.doabarrelroll.net.ClientNetworking; - -public class DoABarrelRollFabricClient implements ClientModInitializer { - @Override - public void onInitializeClient() { - DoABarrelRollClient.init(); - - ClientNetworking.init(); - - ClientTickEvents.END_CLIENT_TICK.register(EventCallbacksClient::clientTick); - - // Register keybindings on fabric - ModKeybindings.ALL.forEach(KeyBindingHelper::registerKeyBinding); - } -} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigResponseC2SPacketImpl.java b/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigResponseC2SPacketImpl.java deleted file mode 100644 index 7de389a9..00000000 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigResponseC2SPacketImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package nl.enjarai.doabarrelroll.net.packet; - -import io.netty.buffer.ByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.network.packet.CustomPayload; -import nl.enjarai.doabarrelroll.DoABarrelRoll; - -public record ConfigResponseC2SPacketImpl(int protocolVersion, boolean success) implements CustomPayload, ConfigResponseC2SPacket { - public static final Id PACKET_ID = new Id<>(DoABarrelRoll.id("config_response")); - public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( - PacketCodecs.INTEGER, ConfigResponseC2SPacketImpl::protocolVersion, - PacketCodecs.BOOL, ConfigResponseC2SPacketImpl::success, - ConfigResponseC2SPacketImpl::new - ); - - @Override - public Id getId() { - return PACKET_ID; - } -} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigSyncS2CPacketImpl.java b/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigSyncS2CPacketImpl.java deleted file mode 100644 index 35363d65..00000000 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigSyncS2CPacketImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -package nl.enjarai.doabarrelroll.net.packet; - -import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.network.packet.CustomPayload; -import nl.enjarai.doabarrelroll.DoABarrelRoll; -import nl.enjarai.doabarrelroll.config.LimitedModConfigServer; -import nl.enjarai.doabarrelroll.config.ModConfigServer; -import org.jetbrains.annotations.Nullable; - -public record ConfigSyncS2CPacketImpl(int protocolVersion, LimitedModConfigServer applicableConfig, boolean isLimited, ModConfigServer fullConfig) implements CustomPayload, ConfigSyncS2CPacket { - public static final Id PACKET_ID = new Id<>(DoABarrelRoll.id("config_sync")); - public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( - PacketCodecs.INTEGER, ConfigSyncS2CPacketImpl::protocolVersion, - LimitedModConfigServer.getPacketCodec(), ConfigSyncS2CPacketImpl::applicableConfig, - PacketCodecs.BOOL, ConfigSyncS2CPacketImpl::isLimited, - ModConfigServer.PACKET_CODEC, ConfigSyncS2CPacketImpl::fullConfig, - ConfigSyncS2CPacketImpl::new - ); - - @Override - public Id getId() { - return PACKET_ID; - } -} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateAckS2CPacketImpl.java b/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateAckS2CPacketImpl.java deleted file mode 100644 index 78bd818c..00000000 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateAckS2CPacketImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package nl.enjarai.doabarrelroll.net.packet; - -import io.netty.buffer.ByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.network.packet.CustomPayload; -import nl.enjarai.doabarrelroll.DoABarrelRoll; - -public record ConfigUpdateAckS2CPacketImpl(int protocolVersion, boolean success) implements CustomPayload, ConfigUpdateAckS2CPacket { - public static final Id PACKET_ID = new Id<>(DoABarrelRoll.id("config_update_ack")); - public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( - PacketCodecs.INTEGER, ConfigUpdateAckS2CPacketImpl::protocolVersion, - PacketCodecs.BOOL, ConfigUpdateAckS2CPacketImpl::success, - ConfigUpdateAckS2CPacketImpl::new - ); - - @Override - public Id getId() { - return PACKET_ID; - } -} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncC2SPacketImpl.java b/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncC2SPacketImpl.java deleted file mode 100644 index 858f8217..00000000 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncC2SPacketImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package nl.enjarai.doabarrelroll.net.packet; - -import io.netty.buffer.ByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.network.packet.CustomPayload; -import nl.enjarai.doabarrelroll.DoABarrelRoll; - -public record RollSyncC2SPacketImpl(boolean rolling, float roll) implements CustomPayload, RollSyncC2SPacket { - public static final Id PACKET_ID = new Id<>(DoABarrelRoll.id("roll_sync")); - public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( - PacketCodecs.BOOL, RollSyncC2SPacketImpl::rolling, - PacketCodecs.FLOAT, RollSyncC2SPacketImpl::roll, - RollSyncC2SPacketImpl::new - ); - - @Override - public Id getId() { - return PACKET_ID; - } -} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncS2CPacketImpl.java b/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncS2CPacketImpl.java deleted file mode 100644 index 622bdde3..00000000 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncS2CPacketImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package nl.enjarai.doabarrelroll.net.packet; - -import io.netty.buffer.ByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.network.packet.CustomPayload; -import nl.enjarai.doabarrelroll.DoABarrelRoll; - -public record RollSyncS2CPacketImpl(int entityId, boolean rolling, float roll) implements CustomPayload, RollSyncS2CPacket { - public static final Id PACKET_ID = new Id<>(DoABarrelRoll.id("roll_sync")); - public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( - PacketCodecs.INTEGER, RollSyncS2CPacketImpl::entityId, - PacketCodecs.BOOL, RollSyncS2CPacketImpl::rolling, - PacketCodecs.FLOAT, RollSyncS2CPacketImpl::roll, - RollSyncS2CPacketImpl::new - ); - - @Override - public Id getId() { - return PACKET_ID; - } -} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/platform/FabricClientNetworkUtils.java b/fabric/src/main/java/nl/enjarai/doabarrelroll/platform/FabricClientNetworkUtils.java deleted file mode 100644 index 55cb4a25..00000000 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/platform/FabricClientNetworkUtils.java +++ /dev/null @@ -1,24 +0,0 @@ -package nl.enjarai.doabarrelroll.platform; - -import nl.enjarai.doabarrelroll.api.RollEntity; -import nl.enjarai.doabarrelroll.config.ModConfigServer; -import nl.enjarai.doabarrelroll.net.ClientNetworking; -import nl.enjarai.doabarrelroll.net.HandshakeClient; -import nl.enjarai.doabarrelroll.platform.services.ClientNetworkUtils; - -public class FabricClientNetworkUtils implements ClientNetworkUtils { - @Override - public void sendRollUpdate(RollEntity entity) { - ClientNetworking.sendRollUpdate(entity); - } - - @Override - public void sendConfigUpdatePacket(ModConfigServer config) { - ClientNetworking.sendConfigUpdatePacket(config); - } - - @Override - public HandshakeClient getHandshakeClient() { - return ClientNetworking.HANDSHAKE_CLIENT; - } -} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/platform/FabricPlatformHelper.java b/fabric/src/main/java/nl/enjarai/doabarrelroll/platform/FabricPlatformHelper.java deleted file mode 100644 index cd03994d..00000000 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/platform/FabricPlatformHelper.java +++ /dev/null @@ -1,59 +0,0 @@ -package nl.enjarai.doabarrelroll.platform; - -import me.lucko.fabric.api.permissions.v0.Permissions; -import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents; -import net.fabricmc.loader.api.FabricLoader; -import net.fabricmc.loader.api.Version; -import net.fabricmc.loader.api.VersionParsingException; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.server.network.ServerPlayNetworkHandler; -import net.minecraft.util.Identifier; -import nl.enjarai.cicada.api.util.ProperLogger; -import nl.enjarai.doabarrelroll.DoABarrelRoll; -import nl.enjarai.doabarrelroll.api.event.ClientEvents; -import nl.enjarai.doabarrelroll.platform.services.PlatformHelper; -import org.slf4j.Logger; - -public class FabricPlatformHelper implements PlatformHelper { - @Override - public String getPlatformName() { - return "Fabric"; - } - - @Override - public Logger getLogger() { - return ProperLogger.getLogger(DoABarrelRoll.MODID); - } - - @Override - public boolean checkPermission(ServerPlayNetworkHandler source, String permission, int defaultPermissionLevel) { - return Permissions.check(source.getPlayer(), permission, defaultPermissionLevel); - } - - @Override - public void registerNetworkChannels(Identifier... channels) { - // No-op - } - - @Override - public void notMyProblem(Screen configScreen, Runnable callback) { - ScreenEvents.remove(configScreen).register(screen1 -> callback.run()); - } - - @Override - public boolean checkModLoaded(String modId) { - return FabricLoader.getInstance().isModLoaded(modId); - } - - @Override - public boolean isModVersionAtLeast(String modId, String version) { - try { - var parsed = Version.parse(version); - return FabricLoader.getInstance().getModContainer("yet_another_config_lib_v3") - .filter(modContainer -> modContainer.getMetadata().getVersion().compareTo(parsed) >= 0) - .isPresent(); - } catch (VersionParsingException e) { - throw new RuntimeException("Skill issue, bad version"); - } - } -} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/platform/FabricServerNetworkUtils.java b/fabric/src/main/java/nl/enjarai/doabarrelroll/platform/FabricServerNetworkUtils.java deleted file mode 100644 index 407d3b3c..00000000 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/platform/FabricServerNetworkUtils.java +++ /dev/null @@ -1,18 +0,0 @@ -package nl.enjarai.doabarrelroll.platform; - -import net.minecraft.entity.Entity; -import nl.enjarai.doabarrelroll.net.ServerConfigHolder; -import nl.enjarai.doabarrelroll.net.ServerNetworking; -import nl.enjarai.doabarrelroll.platform.services.ServerNetworkUtils; - -public class FabricServerNetworkUtils implements ServerNetworkUtils { - @Override - public void sendRollUpdates(Entity entity) { - ServerNetworking.sendRollUpdates(entity); - } - - @Override - public ServerConfigHolder getServerConfigHolder() { - return ServerNetworking.CONFIG_HOLDER; - } -} diff --git a/fabric/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.ClientNetworkUtils b/fabric/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.ClientNetworkUtils deleted file mode 100644 index 85583c3f..00000000 --- a/fabric/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.ClientNetworkUtils +++ /dev/null @@ -1 +0,0 @@ -nl.enjarai.doabarrelroll.platform.FabricClientNetworkUtils \ No newline at end of file diff --git a/fabric/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.PlatformHelper b/fabric/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.PlatformHelper deleted file mode 100644 index 6933884e..00000000 --- a/fabric/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.PlatformHelper +++ /dev/null @@ -1 +0,0 @@ -nl.enjarai.doabarrelroll.platform.FabricPlatformHelper \ No newline at end of file diff --git a/fabric/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.ServerNetworkUtils b/fabric/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.ServerNetworkUtils deleted file mode 100644 index 287a49d1..00000000 --- a/fabric/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.ServerNetworkUtils +++ /dev/null @@ -1 +0,0 @@ -nl.enjarai.doabarrelroll.platform.FabricServerNetworkUtils \ No newline at end of file diff --git a/fabric/src/main/resources/do_a_barrel_roll.fabric.mixins.json b/fabric/src/main/resources/do_a_barrel_roll.fabric.mixins.json deleted file mode 100644 index 9bfd4177..00000000 --- a/fabric/src/main/resources/do_a_barrel_roll.fabric.mixins.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "nl.enjarai.doabarrelroll.mixin.fabric", - "refmap": "${mod_id}.refmap.json", - "compatibilityLevel": "JAVA_17", - "mixins": [ - "CommandManagerMixin" - ], - "client": [ - ], - "server": [ - ], - "injectors": { - "defaultRequire": 1 - } -} diff --git a/gradle.properties b/gradle.properties index b586cfcd..e7cf2698 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,61 +1,36 @@ -# Gradle -org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false +# Done to increase the memory available to gradle. +#fabric.loom.multiProjectOptimisation=true +org.gradle.jvmargs=-Xmx4G +org.gradle.parallel=true +org.gradle.caching=true +org.gradle.caching.debug=false +org.gradle.configureondemand=true -# Project -mod_version=3.6.2 -group=nl.enjarai +# Mod Properties +mod.version=3.7.0 +mod.group=nl.enjarai +mod.id=do_a_barrel_roll +mod.name=Do a Barrel Roll -# Common -minecraft_version=1.21 -yarn_version=1.21+build.2 +# Global Dependencies +deps.mixin_squared=0.1.2-beta.4 +deps.mixin_extras=0.4.1 +deps.cond_mixin=0.6.2 +deps.perm_api=0.2-SNAPSHOT +deps.fabric_loader=0.16.3 -publish_target_min=1.21 -publish_target_max=1.21.1 +# Versioned Dependencies +deps.minecraft=[VERSIONED] +deps.yarn_build=[VERSIONED] +deps.fapi=[VERSIONED] +deps.modmenu=[VERSIONED] +deps.fml=[VERSIONED] +deps.compat=[VERSIONED] +mod.mc_dep=[VERSIONED] +mod.mc_title=[VERSIONED] +mod.mc_targets=[VERSIONED] -# Forge -# The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=20.6.42-beta -# The Forge version range can use any version of Forge as bounds or match the loader version range -forge_version_range=[20.6.42,) -# The loader version range can only use the major version of Forge/FML as bounds -loader_version_range=[1,) -# The Minecraft version range can use any release version of Minecraft as bounds. -# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly -# as they do not follow standard versioning conventions. -forge_minecraft_version_range=[1.20.5,1.21) -# Forgified API version -#forge_fabric_version=0.86.1+1.7.2+1.20.1 -## Forgified Fabric Loader version -#forge_fabric_loader_version=2.2.1+0.14.21+1.20.1 - -# Fabric -fabric_version=0.100.3+1.21 -fabric_loader_version=0.15.11 -fabric_minecraft_version_range=>=1.21- <=1.21.1 - -# Mod options -mod_name=Do a Barrel Roll -mod_author=enjarai -mod_credits=Originally based on Cool Elytra Roll by Jorbon, mod icon by Mizeno -mod_id=do_a_barrel_roll -mod_description=Microsoft flight simulator for Minecraft elytras. -mod_license=GPL-3.0 -mod_url=https://enjarai.dev/ -mod_github=enjarai/do-a-barrel-roll -git_branch=arch/1.21 -mod_modrinth=6FtRfnLg -mod_curseforge=663658 -mod_issue_tracker_url=https://github.com/enjarai/do-a-barrel-roll/issues - -# Dependencies -cicada_version=0.8.0+1.21-and-above -# https://modrinth.com/mod/modmenu/versions#all-versions -modmenu_version=11.0.0 -# https://github.com/isXander/YetAnotherConfigLib/releases -yacl_version=3.5.0+1.21 -# https://github.com/isXander/Controlify/releases -controlify_version=2.0.0-beta.14+1.21 -mixin_extras_version=0.3.2 -mixin_squared_version=0.1.1 -permissions_api_version=0.2-SNAPSHOT +publish.modrinth=6FtRfnLg +publish.curseforge=663658 +publish.github=enjarai/do-a-barrel-roll +publish.branch=stonecutter/1.21 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 17655d0e..0d184210 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/neoforge/build.gradle b/neoforge/build.gradle deleted file mode 100644 index ef143851..00000000 --- a/neoforge/build.gradle +++ /dev/null @@ -1,139 +0,0 @@ -base { - archivesName = "${mod_id}-neoforge" -} - -loom { - neoForge { - accessTransformer {file('src/main/resources/META-INF/accesstransformer.cfg')} - } - -// mixin { -// defaultRefmapName.set("${mod_id}.refmap.json") -// } - - runs { - client { - client() - setConfigName("NeoForge Client") - ideConfigGenerated(true) - runDir("run") - } - server { - server() - setConfigName("NeoForge Server") - ideConfigGenerated(true) - runDir("run") - } - } -} - -sourceSets.main.resources.srcDir 'src/generated/resources' - -dependencies { - minecraft "com.mojang:minecraft:${minecraft_version}" - neoForge "net.neoforged:neoforge:${forge_version}" - mappings "net.fabricmc:yarn:${yarn_version}:v2" - - compileOnly project(":common") - - modCompileOnly("dev.isxander:yet-another-config-lib:${project.yacl_version}-neoforge") { - exclude group: "thedarkcolour" - } - -// implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${project.mixin_extras_version}")) -// implementation(include("io.github.llamalad7:mixinextras-forge:${project.mixin_extras_version}")) -} - -tasks.withType(JavaCompile).configureEach { - source(project(":common").sourceSets.main.allSource) -} -tasks.withType(Javadoc).configureEach { - source(project(":common").sourceSets.main.allJava) -} -tasks.named("sourcesJar", Jar) { - from(project(":common").sourceSets.main.allSource) -} - -// Prevent forge from shouting at me for not having javadocs everywhere -javadoc.enabled = false - -processResources { - from project(":common").sourceSets.main.resources -} - -publishing { - repositories { - maven { - name = "enjaraiMaven" - url = "https://maven.enjarai.dev/releases" - credentials(PasswordCredentials) - authentication { - basic(BasicAuthentication) - } - } - } - - publications { - mavenJava(MavenPublication) { - groupId = rootProject.property('group') - artifactId = "do-a-barrel-roll" - version = "${project.version}-neoforge" - - from components.java - } - } -} - -publishMods { - file = remapJar.archiveFile - displayName = "${property('mod_version')} for NeoForge ${property('minecraft_version')}" - version = "${project.version}-neoforge" - changelog = getRootProject().file("CHANGELOG.md").text - type = STABLE - modLoaders.add("neoforge") - - def min = property('publish_target_min') - def max = property('publish_target_max') - - if (providers.gradleProperty('enjaraiModrinthToken').present) { - modrinth { - projectId = property('mod_modrinth') - accessToken = providers.gradleProperty('enjaraiModrinthToken').get() - - if (min == max) { - minecraftVersions.add(min) - } else { - minecraftVersionRange { - start = min - end = max - } - } - } - } - - if (providers.gradleProperty('enjaraiCurseforgeToken').present) { - curseforge { - projectId = property('mod_curseforge') - accessToken = providers.gradleProperty('enjaraiCurseforgeToken').get() - - if (min == max) { - minecraftVersions.add(min) - } else { - minecraftVersionRange { - start = min - end = max - } - } - } - } - - if (providers.gradleProperty('enjaraiGithubToken').present) { - github { - repository = property('mod_github') - accessToken = providers.gradleProperty('enjaraiGithubToken').get() - - commitish = property('git_branch') - tagName = "${project.version}-neoforge" - } - } -} diff --git a/neoforge/gradle.properties b/neoforge/gradle.properties deleted file mode 100644 index 7da18ea6..00000000 --- a/neoforge/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -loom.platform=neoforge diff --git a/neoforge/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollForge.java b/neoforge/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollForge.java deleted file mode 100644 index f31500bb..00000000 --- a/neoforge/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollForge.java +++ /dev/null @@ -1,64 +0,0 @@ -package nl.enjarai.doabarrelroll; - -import net.minecraft.util.Identifier; -import net.neoforged.fml.ModLoadingContext; -import net.neoforged.fml.common.Mod; -import net.neoforged.fml.loading.FMLLoader; -import net.neoforged.neoforge.client.ConfigScreenHandler; -import nl.enjarai.doabarrelroll.config.ModConfigScreen; -import nl.enjarai.doabarrelroll.platform.services.ClientNetworkUtils; -import nl.enjarai.doabarrelroll.platform.services.ServerNetworkUtils; - -import java.util.HashMap; -import java.util.List; - -@Mod(DoABarrelRoll.MODID) -public class DoABarrelRollForge { - public static final HashMap> CLIENT_LISTENERS = new HashMap<>(); - public static final HashMap> SERVER_LISTENERS = new HashMap<>(); - -// public static final EventNetworkChannel HANDSHAKE_CHANNEL = NetworkRegistry.newEventChannel(DoABarrelRoll.HANDSHAKE_CHANNEL, () -> "", s -> true, s -> true); -// public static final EventNetworkChannel ROLL_CHANNEL = NetworkRegistry.newEventChannel(DoABarrelRoll.ROLL_CHANNEL, () -> "", s -> true, s -> true); - - public DoABarrelRollForge() { - DoABarrelRoll.init(); -// HANDSHAKE_CHANNEL.addListener(this::onHandshakeServerPacket); -// ROLL_CHANNEL.addListener(this::onRollServerPacket); - - if (FMLLoader.getDist().isClient()) { - DoABarrelRollClient.init(); -// HANDSHAKE_CHANNEL.addListener(this::onHandshakeClientPacket); -// ROLL_CHANNEL.addListener(this::onRollClientPacket); - } - - ModLoadingContext.get().registerExtensionPoint( - ConfigScreenHandler.ConfigScreenFactory.class, - () -> new ConfigScreenHandler.ConfigScreenFactory( - (minecraft, parent) -> ModConfigScreen.create(parent) - ) - ); - } - -// private void onHandshakeServerPacket(NetworkEvent.ServerCustomPayloadEvent event) { -// var reply = DoABarrelRoll.HANDSHAKE_SERVER.clientReplied(event.getSource().get().getSender().networkHandler, buf); -// if (reply == HandshakeServer.HandshakeState.ACCEPTED) { -// RollSyncServer.startListening(handler1); -// ServerConfigUpdaterRegister.startListening(handler1); -// } else if (reply == HandshakeServer.HandshakeState.RESEND) { -// // Resending can happen when the client has a different protocol version than expected. -// sendHandshake(player); -// } -// } -// -// private void onHandshakeClientPacket(NetworkEvent.ClientCustomPayloadEvent event) { -// -// } -// -// private void onRollServerPacket(NetworkEvent.ServerCustomPayloadEvent event) { -// event.getPayload() -// } -// -// private void onRollClientPacket(NetworkEvent.ClientCustomPayloadEvent event) { -// -// } -} diff --git a/neoforge/src/main/java/nl/enjarai/doabarrelroll/SillyPayload.java b/neoforge/src/main/java/nl/enjarai/doabarrelroll/SillyPayload.java deleted file mode 100644 index 48eb8ee9..00000000 --- a/neoforge/src/main/java/nl/enjarai/doabarrelroll/SillyPayload.java +++ /dev/null @@ -1,12 +0,0 @@ -package nl.enjarai.doabarrelroll; - -import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.packet.CustomPayload; -import net.minecraft.util.Identifier; - -public record SillyPayload(PacketByteBuf buf, Identifier id) implements CustomPayload { - @Override - public void write(PacketByteBuf buf) { - buf.writeBytes(buf); - } -} diff --git a/neoforge/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModLoader.java b/neoforge/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModLoader.java deleted file mode 100644 index c698978e..00000000 --- a/neoforge/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModLoader.java +++ /dev/null @@ -1,31 +0,0 @@ -package nl.enjarai.doabarrelroll; - -import net.minecraft.server.network.ServerPlayerEntity; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.event.TickEvent; -import net.neoforged.neoforge.event.entity.player.PlayerEvent; -import net.neoforged.neoforge.server.permission.events.PermissionGatherEvent; -import net.neoforged.neoforge.server.permission.nodes.PermissionNode; - -@Mod.EventBusSubscriber -public class WhyIsTherePublicTransportationInThisModLoader { - @SubscribeEvent - public static void gatherPermissions(PermissionGatherEvent.Nodes event) { - event.addNodes(ModPermissions.NODES.toArray(new PermissionNode[0])); - } - - @SubscribeEvent - public static void playerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) { - if (event.getEntity() instanceof ServerPlayerEntity serverPlayer) { - EventCallbacks.playerDisconnected(serverPlayer.networkHandler); - } - } - - @SubscribeEvent - public static void serverTick(TickEvent.ServerTickEvent event) { - if (event.phase == TickEvent.Phase.END) { - EventCallbacks.serverTick(event.getServer()); - } - } -} diff --git a/neoforge/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModLoaderClient.java b/neoforge/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModLoaderClient.java deleted file mode 100644 index d715779f..00000000 --- a/neoforge/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModLoaderClient.java +++ /dev/null @@ -1,23 +0,0 @@ -package nl.enjarai.doabarrelroll; - -import net.minecraft.client.MinecraftClient; -import net.neoforged.api.distmarker.Dist; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent; -import net.neoforged.neoforge.event.TickEvent; - -@Mod.EventBusSubscriber(Dist.CLIENT) -public class WhyIsTherePublicTransportationInThisModLoaderClient { - @SubscribeEvent - public static void clientTick(TickEvent.ClientTickEvent event) { - if (event.phase == TickEvent.Phase.END) { - EventCallbacksClient.clientTick(MinecraftClient.getInstance()); - } - } - - @SubscribeEvent - public static void loggedOut(ClientPlayerNetworkEvent.LoggingOut event) { - EventCallbacksClient.clientDisconnect(); - } -} diff --git a/neoforge/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModLoaderClientMod.java b/neoforge/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModLoaderClientMod.java deleted file mode 100644 index 8fa33208..00000000 --- a/neoforge/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModLoaderClientMod.java +++ /dev/null @@ -1,14 +0,0 @@ -package nl.enjarai.doabarrelroll; - -import net.neoforged.api.distmarker.Dist; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent; - -@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) -public class WhyIsTherePublicTransportationInThisModLoaderClientMod { - @SubscribeEvent - public static void registerKeys(RegisterKeyMappingsEvent event) { - ModKeybindings.ALL.forEach(event::register); - } -} diff --git a/neoforge/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModLoaderMod.java b/neoforge/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModLoaderMod.java deleted file mode 100644 index 1a15f964..00000000 --- a/neoforge/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModLoaderMod.java +++ /dev/null @@ -1,32 +0,0 @@ -package nl.enjarai.doabarrelroll; - -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.Identifier; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent; -import net.neoforged.neoforge.network.event.RegisterPayloadHandlerEvent; -import net.neoforged.neoforge.network.registration.IPayloadRegistrar; - -@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) -public class WhyIsTherePublicTransportationInThisModLoaderMod { - @SubscribeEvent - public static void register(RegisterPayloadHandlerEvent event) { - final IPayloadRegistrar registrar = event.registrar(DoABarrelRoll.MODID); - registerChannel(registrar, DoABarrelRoll.HANDSHAKE_CHANNEL); - registerChannel(registrar, DoABarrelRoll.ROLL_CHANNEL); - } - - private static void registerChannel(IPayloadRegistrar registrar, Identifier id) { - registrar.play(id, buf -> new SillyPayload(buf, id), (payload, ctx) -> { - if (ctx.flow().getReceptionSide().isServer()) { - DoABarrelRollForge.SERVER_LISTENERS.get(id).forEach( - listener -> listener.accept(((ServerPlayerEntity) ctx.player().orElseThrow()).networkHandler, payload.buf(), - replyBuf -> ctx.replyHandler().send(new SillyPayload(replyBuf, id)))); - } else { - DoABarrelRollForge.CLIENT_LISTENERS.get(id).forEach( - listener -> listener.accept(payload.buf(), replyBuf -> ctx.replyHandler().send(new SillyPayload(replyBuf, id)))); - } - }); - } -} diff --git a/neoforge/src/main/java/nl/enjarai/doabarrelroll/mixin/forge/InGameHudMixin.java b/neoforge/src/main/java/nl/enjarai/doabarrelroll/mixin/forge/InGameHudMixin.java deleted file mode 100644 index 8e2b3c17..00000000 --- a/neoforge/src/main/java/nl/enjarai/doabarrelroll/mixin/forge/InGameHudMixin.java +++ /dev/null @@ -1,38 +0,0 @@ -package nl.enjarai.doabarrelroll.mixin.forge; - -import com.llamalad7.mixinextras.sugar.Share; -import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.hud.InGameHud; -import nl.enjarai.doabarrelroll.EventCallbacksClient; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(InGameHud.class) -public abstract class InGameHudMixin { - @Shadow - protected int scaledWidth; - @Shadow - protected int scaledHeight; - - @Inject( - method = "renderCrosshair", - at = @At(value = "HEAD") - ) - private void doABarrelRoll$renderCrosshairHead(DrawContext context, CallbackInfo ci) { - context.getMatrices().push(); - // There's really no way for me to get it, so no tickdelta for you Forge! - EventCallbacksClient.onRenderCrosshair(context, 0, scaledWidth, scaledHeight); - } - - @Inject( - method = "renderCrosshair", - at = @At(value = "RETURN") - ) - private void doABarrelRoll$renderCrosshairReturn(DrawContext context, CallbackInfo ci) { - context.getMatrices().pop(); - } -} diff --git a/neoforge/src/main/java/nl/enjarai/doabarrelroll/platform/ForgeClientNetworkUtils.java b/neoforge/src/main/java/nl/enjarai/doabarrelroll/platform/ForgeClientNetworkUtils.java deleted file mode 100644 index bdc6c549..00000000 --- a/neoforge/src/main/java/nl/enjarai/doabarrelroll/platform/ForgeClientNetworkUtils.java +++ /dev/null @@ -1,25 +0,0 @@ -package nl.enjarai.doabarrelroll.platform; - -import net.minecraft.client.MinecraftClient; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.util.Identifier; -import nl.enjarai.doabarrelroll.DoABarrelRollForge; -import nl.enjarai.doabarrelroll.SillyPayload; -import nl.enjarai.doabarrelroll.platform.services.ClientNetworkUtils; - -import java.util.ArrayList; - -public class ForgeClientNetworkUtils implements ClientNetworkUtils { - @Override - public void sendPacket(Identifier channel, PacketByteBuf buf) { - var handler = MinecraftClient.getInstance().getNetworkHandler(); - if (handler != null) { - handler.send(new SillyPayload(buf, channel)); - } - } - - @Override - public void registerListener(Identifier channel, PacketListener listener) { - DoABarrelRollForge.CLIENT_LISTENERS.computeIfAbsent(channel, id -> new ArrayList<>()).add(listener); - } -} diff --git a/neoforge/src/main/java/nl/enjarai/doabarrelroll/platform/ForgePlatformHelper.java b/neoforge/src/main/java/nl/enjarai/doabarrelroll/platform/ForgePlatformHelper.java deleted file mode 100644 index f1efe9c0..00000000 --- a/neoforge/src/main/java/nl/enjarai/doabarrelroll/platform/ForgePlatformHelper.java +++ /dev/null @@ -1,49 +0,0 @@ -package nl.enjarai.doabarrelroll.platform; - -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.server.network.ServerPlayNetworkHandler; -import net.minecraft.util.Identifier; -import net.neoforged.fml.loading.LoadingModList; -import nl.enjarai.doabarrelroll.DoABarrelRoll; -import nl.enjarai.doabarrelroll.ModPermissions; -import nl.enjarai.doabarrelroll.platform.services.PlatformHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ForgePlatformHelper implements PlatformHelper { - @Override - public String getPlatformName() { - return "Forge"; - } - - @Override - public Logger getLogger() { - return LoggerFactory.getLogger(DoABarrelRoll.MODID); - } - - @Override - public boolean checkPermission(ServerPlayNetworkHandler source, String permission, int defaultPermissionLevel) { - return ModPermissions.resolve(source.getPlayer(), permission, defaultPermissionLevel); - } - - @Override - public void registerNetworkChannels(Identifier... channels) { - // Network channels on NeoForge are registered in an event, so we'll have to do it manually there... - } - - @Override - public void notMyProblem(Screen ConfigScreen, Runnable callback) { - // Get memory leak'd idiots - } - - @Override - public boolean checkModLoaded(String modId) { - return LoadingModList.get().getMods().stream().anyMatch(mod -> mod.getModId().equals(modId)); - } - - @Override - public boolean isModVersionAtLeast(String modId, String version) { - // Yea sure it probably is, see if i care! - return true; - } -} \ No newline at end of file diff --git a/neoforge/src/main/java/nl/enjarai/doabarrelroll/platform/ForgeServerNetworkUtils.java b/neoforge/src/main/java/nl/enjarai/doabarrelroll/platform/ForgeServerNetworkUtils.java deleted file mode 100644 index 5b126367..00000000 --- a/neoforge/src/main/java/nl/enjarai/doabarrelroll/platform/ForgeServerNetworkUtils.java +++ /dev/null @@ -1,35 +0,0 @@ -package nl.enjarai.doabarrelroll.platform; - -import net.minecraft.entity.Entity; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.server.network.ServerPlayNetworkHandler; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.Identifier; -import nl.enjarai.doabarrelroll.DoABarrelRollForge; -import nl.enjarai.doabarrelroll.SillyPayload; -import nl.enjarai.doabarrelroll.platform.services.ServerNetworkUtils; - -import java.util.ArrayList; -import java.util.function.Predicate; - -public class ForgeServerNetworkUtils implements ServerNetworkUtils { - @Override - public void sendPacket(ServerPlayNetworkHandler handler, Identifier channel, PacketByteBuf buf) { - handler.send(new SillyPayload(buf, channel)); - } - - @Override - public void sendPacketsToTracking(Entity entity, Predicate predicate, Identifier channel, PacketByteBuf buf) { - entity.getWorld().getPlayers().stream() - .filter(player -> player != entity) - // Temporary solution until I can figure out how to find tracked players on NeoForge. - .filter(player -> entity.getEyePos().squaredDistanceTo(player.getPos()) <= 16 * 10) - .filter(player -> predicate.test((ServerPlayerEntity) player)) - .forEach(player -> ((ServerPlayerEntity) player).networkHandler.send(new SillyPayload(buf, channel))); - } - - @Override - public void registerListener(Identifier channel, PacketListener listener) { - DoABarrelRollForge.SERVER_LISTENERS.computeIfAbsent(channel, id -> new ArrayList<>()).add(listener); - } -} diff --git a/neoforge/src/main/resources/META-INF/mods.toml b/neoforge/src/main/resources/META-INF/mods.toml deleted file mode 100644 index e543a470..00000000 --- a/neoforge/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,75 +0,0 @@ -# This is an example mods.toml file. It contains the data relating to the loading mods. -# There are several mandatory fields (#mandatory), and many more that are optional (#optional). -# The overall format is standard TOML format, v0.5.0. -# Note that there are a couple of TOML lists in this file. -# Find more information on toml format here: https://github.com/toml-lang/toml -# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml -modLoader = "javafml" #mandatory -loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. -# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. -# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. -license = "${mod_license}" -# A URL to refer people to when problems occur with this mod -#issueTrackerURL="${mod_issue_tracker_url}" #optional -# A list of mods - how many allowed here is determined by the individual mod loader -[[mods]] #mandatory -# The modid of the mod -modId = "${mod_id}" #mandatory -# The version number of the mod -version = "${mod_version}" #mandatory -# A display name for the mod -displayName = "${mod_name}" #mandatory -# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/ -#updateJSONURL="https://change.me.example.invalid/updates.json" #optional -# A URL for the "homepage" for this mod, displayed in the mod UI -#displayURL="${mod_url}" #optional (displayed in the mod UI) -# A file name (in the root of the mod JAR) containing a logo for display -logoFile = "assets/do_a_barrel_roll/icon.png" #optional -# A text field displayed in the mod UI -credits = "${mod_credits}" #optional -# A text field displayed in the mod UI -authors = "${mod_author}" #optional -# Display Test controls the display for your mod in the server connection screen -# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod. -# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod. -# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component. -# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value. -# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself. -#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional) - -[[mixins]] -config = 'do_a_barrel_roll.mixins.json' -[[mixins]] -config = 'do_a_barrel_roll.neoforge.mixins.json' - -[[accessTransformers]] -file="META-INF/accesstransformer.cfg" - -# The description text for the mod (multi line!) (#mandatory) -description='''${mod_description}''' -[[dependencies.'${mod_id}']] #optional - # the modid of the dependency - modId = "neoforge" #mandatory - # Does this dependency have to exist - if not, ordering below must be specified - type = "required" #mandatory - # The version range of the dependency - versionRange = "${forge_version_range}" #mandatory - # An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory - # BEFORE - This mod is loaded BEFORE the dependency - # AFTER - This mod is loaded AFTER the dependency - ordering = "NONE" - # Side this dependency is applied on - BOTH, CLIENT, or SERVER - side = "BOTH" # Side this dependency is applied on - 'BOTH', 'CLIENT' or 'SERVER' -[[dependencies.'${mod_id}']] - modId = "minecraft" - type = "required" - # This version range declares a minimum of the current minecraft version up to but not including the next major version - versionRange = "${forge_minecraft_version_range}" - ordering = "NONE" - side = "BOTH" - -# Features are specific properties of the game environment, that you may want to declare you require. This example declares -# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't -# stop your mod loading on the server for example. -#[features.${mod_id}] -#openGLVersion="[3.2,)" diff --git a/neoforge/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.ClientNetworkUtils b/neoforge/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.ClientNetworkUtils deleted file mode 100644 index dbf23654..00000000 --- a/neoforge/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.ClientNetworkUtils +++ /dev/null @@ -1 +0,0 @@ -nl.enjarai.doabarrelroll.platform.ForgeClientNetworkUtils \ No newline at end of file diff --git a/neoforge/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.PlatformHelper b/neoforge/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.PlatformHelper deleted file mode 100644 index 74b37777..00000000 --- a/neoforge/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.PlatformHelper +++ /dev/null @@ -1 +0,0 @@ -nl.enjarai.doabarrelroll.platform.ForgePlatformHelper \ No newline at end of file diff --git a/neoforge/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.ServerNetworkUtils b/neoforge/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.ServerNetworkUtils deleted file mode 100644 index 3fa59e9c..00000000 --- a/neoforge/src/main/resources/META-INF/services/nl.enjarai.doabarrelroll.platform.services.ServerNetworkUtils +++ /dev/null @@ -1 +0,0 @@ -nl.enjarai.doabarrelroll.platform.ForgeServerNetworkUtils \ No newline at end of file diff --git a/neoforge/src/main/resources/do_a_barrel_roll.neoforge.mixins.json b/neoforge/src/main/resources/do_a_barrel_roll.neoforge.mixins.json deleted file mode 100644 index f39ca0da..00000000 --- a/neoforge/src/main/resources/do_a_barrel_roll.neoforge.mixins.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "nl.enjarai.doabarrelroll.mixin.forge", - "refmap": "${mod_id}.refmap.json", - "compatibilityLevel": "JAVA_17", - "mixins": [ - ], - "client": [ - "InGameHudMixin" - ], - "server": [ - ], - "injectors": { - "defaultRequire": 1 - } -} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 0ddd7c0d..00000000 --- a/settings.gradle +++ /dev/null @@ -1,38 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - maven { - name = 'Forge' - url = 'https://maven.minecraftforge.net/' - } - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - maven { - name = 'Architectury' - url = "https://maven.architectury.dev/" - } - maven { url "https://maven.enjarai.nl/mirrors"} - } - resolutionStrategy { - eachPlugin { - switch (requested.id.id) { - case "me.fallenbreath.yamlang": { - useModule("com.github.Fallen-Breath:yamlang:${requested.version}") - break - } - } - } - } -} - -plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' -} - -// This should match the folder name of the project, or else IDEA may complain (see https://youtrack.jetbrains.com/issue/IDEA-317606) -rootProject.name = 'do-a-barrel-roll' -include("common") -include("fabric") -//include("neoforge") diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..25d96283 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,41 @@ +import dev.kikugie.stonecutter.StonecutterSettings + +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + maven("https://maven.fabricmc.net/") + maven("https://maven.architectury.dev") + maven("https://maven.minecraftforge.net") + maven("https://maven.neoforged.net/releases/") + maven("https://maven.kikugie.dev/releases") + } +} + +plugins { + id("dev.kikugie.stonecutter") version "0.4.+" +} + +extensions.configure { + kotlinController = true + centralScript = "build.gradle.kts" + shared { + fun mc(version: String, vararg loaders: String) { + for (it in loaders) vers("$version-$it", version) + } + //mc("1.19.4", "fabric", "forge") + //mc("1.20.1", "fabric", "forge") + //mc("1.20.2", "fabric", "forge") + //mc("1.20.4", "fabric", "neoforge") + //mc("1.20.6", "fabric", "neoforge") + mc("1.21", "fabric", "neoforge") + } + create(rootProject) +} +rootProject.name = "Do a Barrel Roll" + +include("extensions") +val ext = project(":extensions") +listOf("common", "fabric", "forge", "neoforge").forEach { + include("extensions:$it") +} \ No newline at end of file diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/DABRMixinCanceller.java b/src/main/java/nl/enjarai/doabarrelroll/DABRMixinCanceller.java similarity index 97% rename from fabric/src/main/java/nl/enjarai/doabarrelroll/DABRMixinCanceller.java rename to src/main/java/nl/enjarai/doabarrelroll/DABRMixinCanceller.java index 54eff99f..671779a0 100644 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/DABRMixinCanceller.java +++ b/src/main/java/nl/enjarai/doabarrelroll/DABRMixinCanceller.java @@ -2,7 +2,6 @@ import com.bawnorton.mixinsquared.api.MixinCanceller; import com.bawnorton.mixinsquared.tools.MixinAnnotationReader; -import net.fabricmc.loader.api.FabricLoader; import java.util.List; diff --git a/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRoll.java b/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRoll.java new file mode 100644 index 00000000..6bdfa4e6 --- /dev/null +++ b/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRoll.java @@ -0,0 +1,47 @@ +package nl.enjarai.doabarrelroll; + +import io.netty.buffer.Unpooled; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.server.network.ServerPlayNetworkHandler; +import net.minecraft.util.Identifier; +//? if fabric { +import nl.enjarai.cicada.api.util.ProperLogger; +import me.lucko.fabric.api.permissions.v0.Permissions; +//?} else { +/*import nl.enjarai.doabarrelroll.util.ModPermissions; +*///?} +import nl.enjarai.doabarrelroll.net.ServerNetworking; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DoABarrelRoll { + public static final String MODID = "do_a_barrel_roll"; + public static final Logger LOGGER = + //? if fabric { + ProperLogger.getLogger(MODID); + //?} else + /*LoggerFactory.getLogger(MODID);*/ + + public static final Identifier HANDSHAKE_CHANNEL = id("handshake"); + public static final Identifier SERVER_CONFIG_UPDATE_CHANNEL = id("server_config_update"); + public static final Identifier ROLL_CHANNEL = id("player_roll"); + + public static Identifier id(String path) { + return Identifier.of(MODID, path); + } + + public static void init() { + ServerNetworking.init(); + } + + public static PacketByteBuf createBuf() { + return new PacketByteBuf(Unpooled.buffer()); + } + + public static boolean checkPermission(ServerPlayNetworkHandler handler, String permission, int operatorLevel) { + //? if fabric { + return Permissions.check(handler.getPlayer(), permission, operatorLevel); + //?} else + /*return ModPermissions.resolve(handler.getPlayer(), permission, operatorLevel);*/ + } +} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollClient.java b/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollClient.java similarity index 85% rename from common/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollClient.java rename to src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollClient.java index 673a348b..5c0af7b2 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollClient.java +++ b/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollClient.java @@ -1,5 +1,7 @@ package nl.enjarai.doabarrelroll; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; import net.minecraft.client.MinecraftClient; import net.minecraft.util.math.Smoother; import nl.enjarai.doabarrelroll.api.event.ClientEvents; @@ -9,7 +11,7 @@ import nl.enjarai.doabarrelroll.config.LimitedModConfigServer; import nl.enjarai.doabarrelroll.config.ModConfig; import nl.enjarai.doabarrelroll.flight.RotationModifiers; -import nl.enjarai.doabarrelroll.platform.Services; +import nl.enjarai.doabarrelroll.net.ClientNetworking; import nl.enjarai.doabarrelroll.util.MixinHooks; import nl.enjarai.doabarrelroll.util.StarFoxUtil; @@ -49,7 +51,14 @@ public static void init() { // Init barrel rollery. StarFoxUtil.register(); - } + + + ClientNetworking.init(); + + ClientTickEvents.END_CLIENT_TICK.register(EventCallbacksClient::clientTick); + + // Register keybindings on fabric + ModKeybindings.ALL.forEach(KeyBindingHelper::registerKeyBinding); } public static void clearValues() { PITCH_SMOOTHER.clear(); @@ -58,7 +67,7 @@ public static void clearValues() { } public static boolean isFallFlying() { - if (!Services.CLIENT_NET.getHandshakeClient().getConfig().map(LimitedModConfigServer::forceEnabled).orElse(false)) { + if (!ClientNetworking.HANDSHAKE_CLIENT.getConfig().map(LimitedModConfigServer::forceEnabled).orElse(false)) { var hybrid = ModConfig.INSTANCE.getActivationBehaviour() == ActivationBehaviour.HYBRID || ModConfig.INSTANCE.getActivationBehaviour() == ActivationBehaviour.HYBRID_TOGGLE; if (hybrid && !MixinHooks.thirdJump) { diff --git a/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollInitializer.java b/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollInitializer.java new file mode 100644 index 00000000..ccfbb292 --- /dev/null +++ b/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollInitializer.java @@ -0,0 +1,40 @@ +package nl.enjarai.doabarrelroll; + +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.api.ModInitializer; + +//? if fabric { +public class DoABarrelRollInitializer implements ModInitializer, ClientModInitializer { + @Override + public void onInitializeClient() { + DoABarrelRollClient.init(); + } + + @Override + public void onInitialize() { + DoABarrelRoll.init(); + } +} +//?} else { +/*import net.neoforged.fml.ModLoadingContext; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.loading.FMLLoader; +import net.neoforged.neoforge.client.gui.IConfigScreenFactory; +import nl.enjarai.doabarrelroll.config.ModConfigScreen; + +@Mod(DoABarrelRoll.MODID) +public class DoABarrelRollInitializer { + public DoABarrelRollInitializer() { + DoABarrelRoll.init(); + + if (FMLLoader.getDist().isClient()) { + DoABarrelRollClient.init(); + } + + ModLoadingContext.get().registerExtensionPoint( + IConfigScreenFactory.class, + () -> (mod, parent) -> ModConfigScreen.create(parent) + ); + } +} +*///?} \ No newline at end of file diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/EventCallbacksClient.java b/src/main/java/nl/enjarai/doabarrelroll/EventCallbacksClient.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/EventCallbacksClient.java rename to src/main/java/nl/enjarai/doabarrelroll/EventCallbacksClient.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/ModKeybindings.java b/src/main/java/nl/enjarai/doabarrelroll/ModKeybindings.java similarity index 95% rename from common/src/main/java/nl/enjarai/doabarrelroll/ModKeybindings.java rename to src/main/java/nl/enjarai/doabarrelroll/ModKeybindings.java index 35af4375..af5c30ee 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/ModKeybindings.java +++ b/src/main/java/nl/enjarai/doabarrelroll/ModKeybindings.java @@ -8,7 +8,7 @@ import nl.enjarai.doabarrelroll.config.LimitedModConfigServer; import nl.enjarai.doabarrelroll.config.ModConfig; import nl.enjarai.doabarrelroll.config.ModConfigScreen; -import nl.enjarai.doabarrelroll.platform.Services; +import nl.enjarai.doabarrelroll.net.ClientNetworking; import org.lwjgl.glfw.GLFW; import java.util.List; @@ -115,7 +115,7 @@ public class ModKeybindings { public static void clientTick(MinecraftClient client) { while (TOGGLE_ENABLED.wasPressed()) { - if (!Services.CLIENT_NET.getHandshakeClient().getConfig().map(LimitedModConfigServer::forceEnabled).orElse(false)) { + if (!ClientNetworking.HANDSHAKE_CLIENT.getConfig().map(LimitedModConfigServer::forceEnabled).orElse(false)) { ModConfig.INSTANCE.setModEnabled(!ModConfig.INSTANCE.getModEnabled()); ModConfig.INSTANCE.save(); @@ -138,7 +138,7 @@ public static void clientTick(MinecraftClient client) { } } while (TOGGLE_THRUST.wasPressed()) { - if (Services.CLIENT_NET.getHandshakeClient().getConfig().map(LimitedModConfigServer::allowThrusting).orElse(false)) { + if (ClientNetworking.HANDSHAKE_CLIENT.getConfig().map(LimitedModConfigServer::allowThrusting).orElse(false)) { ModConfig.INSTANCE.setEnableThrust(!ModConfig.INSTANCE.getEnableThrust()); ModConfig.INSTANCE.save(); diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/ModMath.java b/src/main/java/nl/enjarai/doabarrelroll/ModMath.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/ModMath.java rename to src/main/java/nl/enjarai/doabarrelroll/ModMath.java diff --git a/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModloader.java b/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModloader.java new file mode 100644 index 00000000..643f6c24 --- /dev/null +++ b/src/main/java/nl/enjarai/doabarrelroll/WhyIsTherePublicTransportationInThisModloader.java @@ -0,0 +1,17 @@ +//? if !fabric { +/*package nl.enjarai.doabarrelroll; + +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.server.permission.events.PermissionGatherEvent; +import net.neoforged.neoforge.server.permission.nodes.PermissionNode; +import nl.enjarai.doabarrelroll.util.ModPermissions; + +@EventBusSubscriber +public class WhyIsTherePublicTransportationInThisModloader { + @SubscribeEvent + public static void gatherPermissions(PermissionGatherEvent.Nodes event) { + event.addNodes(ModPermissions.NODES.toArray(new PermissionNode[0])); + } +} +*///?} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/RollCamera.java b/src/main/java/nl/enjarai/doabarrelroll/api/RollCamera.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/RollCamera.java rename to src/main/java/nl/enjarai/doabarrelroll/api/RollCamera.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/RollEntity.java b/src/main/java/nl/enjarai/doabarrelroll/api/RollEntity.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/RollEntity.java rename to src/main/java/nl/enjarai/doabarrelroll/api/RollEntity.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/RollMouse.java b/src/main/java/nl/enjarai/doabarrelroll/api/RollMouse.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/RollMouse.java rename to src/main/java/nl/enjarai/doabarrelroll/api/RollMouse.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/event/ClientEvents.java b/src/main/java/nl/enjarai/doabarrelroll/api/event/ClientEvents.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/event/ClientEvents.java rename to src/main/java/nl/enjarai/doabarrelroll/api/event/ClientEvents.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/event/Event.java b/src/main/java/nl/enjarai/doabarrelroll/api/event/Event.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/event/Event.java rename to src/main/java/nl/enjarai/doabarrelroll/api/event/Event.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/event/RollContext.java b/src/main/java/nl/enjarai/doabarrelroll/api/event/RollContext.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/event/RollContext.java rename to src/main/java/nl/enjarai/doabarrelroll/api/event/RollContext.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/event/RollEvents.java b/src/main/java/nl/enjarai/doabarrelroll/api/event/RollEvents.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/event/RollEvents.java rename to src/main/java/nl/enjarai/doabarrelroll/api/event/RollEvents.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/event/RollGroup.java b/src/main/java/nl/enjarai/doabarrelroll/api/event/RollGroup.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/event/RollGroup.java rename to src/main/java/nl/enjarai/doabarrelroll/api/event/RollGroup.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/event/ServerEvents.java b/src/main/java/nl/enjarai/doabarrelroll/api/event/ServerEvents.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/event/ServerEvents.java rename to src/main/java/nl/enjarai/doabarrelroll/api/event/ServerEvents.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/event/StarFox64Events.java b/src/main/java/nl/enjarai/doabarrelroll/api/event/StarFox64Events.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/event/StarFox64Events.java rename to src/main/java/nl/enjarai/doabarrelroll/api/event/StarFox64Events.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/event/ThrustEvents.java b/src/main/java/nl/enjarai/doabarrelroll/api/event/ThrustEvents.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/event/ThrustEvents.java rename to src/main/java/nl/enjarai/doabarrelroll/api/event/ThrustEvents.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/event/TriState.java b/src/main/java/nl/enjarai/doabarrelroll/api/event/TriState.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/event/TriState.java rename to src/main/java/nl/enjarai/doabarrelroll/api/event/TriState.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/key/InputContext.java b/src/main/java/nl/enjarai/doabarrelroll/api/key/InputContext.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/key/InputContext.java rename to src/main/java/nl/enjarai/doabarrelroll/api/key/InputContext.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/api/rotation/RotationInstant.java b/src/main/java/nl/enjarai/doabarrelroll/api/rotation/RotationInstant.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/api/rotation/RotationInstant.java rename to src/main/java/nl/enjarai/doabarrelroll/api/rotation/RotationInstant.java diff --git a/src/main/java/nl/enjarai/doabarrelroll/compat/Compat.java b/src/main/java/nl/enjarai/doabarrelroll/compat/Compat.java new file mode 100644 index 00000000..ea9c6b78 --- /dev/null +++ b/src/main/java/nl/enjarai/doabarrelroll/compat/Compat.java @@ -0,0 +1,32 @@ +package nl.enjarai.doabarrelroll.compat; + +import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.Version; +import net.fabricmc.loader.api.VersionParsingException; + +public class Compat { + public static final String YACL_MIN_VERSION = "3.1.0"; + + public static boolean isYACLLoaded() { + return checkModLoaded("yet_another_config_lib_v3"); + } + + public static boolean isYACLUpToDate() { + return isModVersionAtLeast("yet_another_config_lib_v3", YACL_MIN_VERSION); + } + + public static boolean checkModLoaded(String modId) { + return FabricLoader.getInstance().isModLoaded(modId); + } + + public static boolean isModVersionAtLeast(String modId, String version) { + try { + var parsed = Version.parse(version); + return FabricLoader.getInstance().getModContainer("yet_another_config_lib_v3") + .filter(modContainer -> modContainer.getMetadata().getVersion().compareTo(parsed) >= 0) + .isPresent(); + } catch (VersionParsingException e) { + throw new RuntimeException("Skill issue, bad version"); + } + } +} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/CameraOverhaulPlugin.java b/src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/CameraOverhaulPlugin.java similarity index 93% rename from fabric/src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/CameraOverhaulPlugin.java rename to src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/CameraOverhaulPlugin.java index 0456f8d5..657c3e5f 100644 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/CameraOverhaulPlugin.java +++ b/src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/CameraOverhaulPlugin.java @@ -1,3 +1,4 @@ +//? if fabric { package nl.enjarai.doabarrelroll.compat.cameraoverhaul; import nl.enjarai.cicada.api.compat.CompatMixinPlugin; @@ -10,3 +11,4 @@ public Set getRequiredMods() { return Set.of("cameraoverhaul"); } } +//?} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/mixin/CameraSystemMixin.java b/src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/mixin/CameraSystemMixin.java similarity index 98% rename from fabric/src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/mixin/CameraSystemMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/mixin/CameraSystemMixin.java index bc98308d..402fa5ef 100644 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/mixin/CameraSystemMixin.java +++ b/src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/mixin/CameraSystemMixin.java @@ -5,12 +5,14 @@ import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; @Pseudo @Mixin(targets = "mirsario.cameraoverhaul.common.systems.CameraSystem") public abstract class CameraSystemMixin { + @Unique private boolean allowModifications() { return !(MinecraftClient.getInstance().getCameraEntity() instanceof RollEntity rollEntity && rollEntity.doABarrelRoll$isRolling()); } diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/compat/controlify/ControlifyCompat.java b/src/main/java/nl/enjarai/doabarrelroll/compat/controlify/ControlifyCompat.java similarity index 99% rename from fabric/src/main/java/nl/enjarai/doabarrelroll/compat/controlify/ControlifyCompat.java rename to src/main/java/nl/enjarai/doabarrelroll/compat/controlify/ControlifyCompat.java index ca85d188..dfce981e 100644 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/compat/controlify/ControlifyCompat.java +++ b/src/main/java/nl/enjarai/doabarrelroll/compat/controlify/ControlifyCompat.java @@ -1,3 +1,4 @@ +//? if fabric { package nl.enjarai.doabarrelroll.compat.controlify; import dev.isxander.controlify.api.ControlifyApi; @@ -145,3 +146,4 @@ public void onControlifyPreInit(ControlifyApi controlifyApi) { public void onControllersDiscovered(ControlifyApi controlifyApi) { } } +//?} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuIntegration.java b/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuIntegration.java similarity index 97% rename from fabric/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuIntegration.java rename to src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuIntegration.java index 1adc45db..7cac2ae1 100644 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuIntegration.java +++ b/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuIntegration.java @@ -1,3 +1,4 @@ +//? if fabric { package nl.enjarai.doabarrelroll.compat.modmenu; import com.terraformersmc.modmenu.api.ConfigScreenFactory; @@ -19,3 +20,4 @@ public ConfigScreenFactory getModConfigScreenFactory() { return ModConfigScreen::create; } } +//?} \ No newline at end of file diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuPlugin.java b/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuPlugin.java similarity index 93% rename from fabric/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuPlugin.java rename to src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuPlugin.java index 8f6dfe4f..a8895c7a 100644 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuPlugin.java +++ b/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuPlugin.java @@ -1,3 +1,4 @@ +//? if fabric { package nl.enjarai.doabarrelroll.compat.modmenu; import nl.enjarai.cicada.api.compat.CompatMixinPlugin; @@ -10,3 +11,4 @@ public Set getRequiredMods() { return Set.of("modmenu"); } } +//?} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/mixin/ModsScreenMixin.java b/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/mixin/ModsScreenMixin.java similarity index 99% rename from fabric/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/mixin/ModsScreenMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/mixin/ModsScreenMixin.java index 733d3fee..a4db63f3 100644 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/mixin/ModsScreenMixin.java +++ b/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/mixin/ModsScreenMixin.java @@ -1,3 +1,4 @@ +//? if fabric { package nl.enjarai.doabarrelroll.compat.modmenu.mixin; import com.terraformersmc.modmenu.gui.ModsScreen; @@ -61,3 +62,4 @@ private void onRender(DrawContext context, int mouseX, int mouseY, float delta, } } } +//?} \ No newline at end of file diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/compat/yacl/ExpressionParserController.java b/src/main/java/nl/enjarai/doabarrelroll/compat/yacl/ExpressionParserController.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/compat/yacl/ExpressionParserController.java rename to src/main/java/nl/enjarai/doabarrelroll/compat/yacl/ExpressionParserController.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/compat/yacl/YACLImplementation.java b/src/main/java/nl/enjarai/doabarrelroll/compat/yacl/YACLImplementation.java similarity index 96% rename from common/src/main/java/nl/enjarai/doabarrelroll/compat/yacl/YACLImplementation.java rename to src/main/java/nl/enjarai/doabarrelroll/compat/yacl/YACLImplementation.java index 424e491c..f00fa224 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/compat/yacl/YACLImplementation.java +++ b/src/main/java/nl/enjarai/doabarrelroll/compat/yacl/YACLImplementation.java @@ -5,6 +5,7 @@ import dev.isxander.yacl3.api.controller.EnumControllerBuilder; import dev.isxander.yacl3.api.controller.IntegerSliderControllerBuilder; import dev.isxander.yacl3.api.controller.TickBoxControllerBuilder; +import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; @@ -18,10 +19,11 @@ import nl.enjarai.doabarrelroll.DoABarrelRollClient; import nl.enjarai.doabarrelroll.ModKeybindings; import nl.enjarai.doabarrelroll.api.event.ClientEvents; +import nl.enjarai.doabarrelroll.compat.Compat; import nl.enjarai.doabarrelroll.config.*; import nl.enjarai.doabarrelroll.math.ExpressionParser; -import nl.enjarai.doabarrelroll.net.ServerConfigUpdateClient; -import nl.enjarai.doabarrelroll.platform.Services; +import nl.enjarai.doabarrelroll.net.ClientNetworking; +import nl.enjarai.doabarrelroll.net.ServerNetworking; import java.net.URI; import java.util.ArrayList; @@ -36,7 +38,7 @@ public static Screen generateConfigScreen(Screen parent) { ClientPlayerEntity player; var onRealms = DoABarrelRollClient.isConnectedToRealms() && (player = MinecraftClient.getInstance().player) != null && player.hasPermissionLevel(2); - var serverConfig = Services.CLIENT_NET.getHandshakeClient().getConfig(); + var serverConfig = ClientNetworking.HANDSHAKE_CLIENT.getConfig(); var thrustingAllowed = new Dependable(serverConfig.map(LimitedModConfigServer::allowThrusting).orElse(!inWorld || onRealms)); var allowDisabled = new Dependable(!serverConfig.map(LimitedModConfigServer::forceEnabled).orElse(false)); @@ -166,7 +168,7 @@ public static Screen generateConfigScreen(Screen parent) { .build()) .group(OptionGroup.createBuilder() .name(getText("controller")) - .collapsed(!(Services.PLATFORM.checkModLoaded("controlify") || Services.PLATFORM.checkModLoaded("midnightcontrols"))) + .collapsed(!(Compat.checkModLoaded("controlify") || Compat.checkModLoaded("midnightcontrols"))) .description(OptionDescription.createBuilder() .text(getText("controller.description")) .build()) @@ -244,8 +246,8 @@ public static Screen generateConfigScreen(Screen parent) { // If we're in a world, use the synced config, otherwise, grab our local one. var fullServerConfig = inWorld - ? Services.CLIENT_NET.getHandshakeClient().getFullConfig() - : Optional.of(Services.SERVER_NET.getServerConfigHolder().instance); + ? ClientNetworking.HANDSHAKE_CLIENT.getFullConfig() + : Optional.of(ServerNetworking.CONFIG_HOLDER.instance); MutableConfigServer mut; if (fullServerConfig.isPresent()) { mut = new MutableConfigServer(fullServerConfig.get()); @@ -295,13 +297,13 @@ public static Screen generateConfigScreen(Screen parent) { if (mut != null) { if (MinecraftClient.getInstance().world == null) { - Services.SERVER_NET.getServerConfigHolder().instance = mut.toImmutable(); + ServerNetworking.CONFIG_HOLDER.instance = mut.toImmutable(); } else { - var original = Services.CLIENT_NET.getHandshakeClient().getConfig(); + var original = ClientNetworking.HANDSHAKE_CLIENT.getConfig(); if (original.isPresent()){ var imut = mut.toImmutable(); if (!imut.equals(original.get())) { - Services.CLIENT_NET.sendConfigUpdatePacket(imut); + ClientNetworking.sendConfigUpdatePacket(imut); configListener.accept(imut); } } @@ -312,7 +314,7 @@ public static Screen generateConfigScreen(Screen parent) { // Add a listener for this screen to update elements when the server config changes. ClientEvents.ServerConfigUpdateEvent listener = configListener::accept; ClientEvents.SERVER_CONFIG_UPDATE.register(listener); - Services.PLATFORM.notMyProblem(screen, () -> ClientEvents.SERVER_CONFIG_UPDATE.unregister(listener)); + ScreenEvents.remove(screen).register(screen1 -> ClientEvents.SERVER_CONFIG_UPDATE.unregister(listener)); }) .build() .generateScreen(parent); diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/config/ActivationBehaviour.java b/src/main/java/nl/enjarai/doabarrelroll/config/ActivationBehaviour.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/config/ActivationBehaviour.java rename to src/main/java/nl/enjarai/doabarrelroll/config/ActivationBehaviour.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/config/KineticDamage.java b/src/main/java/nl/enjarai/doabarrelroll/config/KineticDamage.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/config/KineticDamage.java rename to src/main/java/nl/enjarai/doabarrelroll/config/KineticDamage.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/config/LimitedModConfigServer.java b/src/main/java/nl/enjarai/doabarrelroll/config/LimitedModConfigServer.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/config/LimitedModConfigServer.java rename to src/main/java/nl/enjarai/doabarrelroll/config/LimitedModConfigServer.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/config/MigrationValue.java b/src/main/java/nl/enjarai/doabarrelroll/config/MigrationValue.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/config/MigrationValue.java rename to src/main/java/nl/enjarai/doabarrelroll/config/MigrationValue.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/config/ModConfig.java b/src/main/java/nl/enjarai/doabarrelroll/config/ModConfig.java similarity index 99% rename from common/src/main/java/nl/enjarai/doabarrelroll/config/ModConfig.java rename to src/main/java/nl/enjarai/doabarrelroll/config/ModConfig.java index 75d03aa9..f1e3828f 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/config/ModConfig.java +++ b/src/main/java/nl/enjarai/doabarrelroll/config/ModConfig.java @@ -10,7 +10,7 @@ import nl.enjarai.doabarrelroll.api.rotation.RotationInstant; import nl.enjarai.doabarrelroll.config.serialization.ExpressionParserTypeAdapter; import nl.enjarai.doabarrelroll.math.ExpressionParser; -import nl.enjarai.doabarrelroll.platform.Services; +import nl.enjarai.doabarrelroll.net.ClientNetworking; import nl.enjarai.doabarrelroll.util.ToastUtil; import java.io.*; @@ -179,7 +179,7 @@ public boolean getEnableThrust() { return true; } - return Services.CLIENT_NET.getHandshakeClient().getConfig() + return ClientNetworking.HANDSHAKE_CLIENT.getConfig() .map(LimitedModConfigServer::allowThrusting) .orElse(false); } diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/config/ModConfigScreen.java b/src/main/java/nl/enjarai/doabarrelroll/config/ModConfigScreen.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/config/ModConfigScreen.java rename to src/main/java/nl/enjarai/doabarrelroll/config/ModConfigScreen.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/config/ModConfigServer.java b/src/main/java/nl/enjarai/doabarrelroll/config/ModConfigServer.java similarity index 90% rename from common/src/main/java/nl/enjarai/doabarrelroll/config/ModConfigServer.java rename to src/main/java/nl/enjarai/doabarrelroll/config/ModConfigServer.java index 50c1c6b7..3d5a0aaf 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/config/ModConfigServer.java +++ b/src/main/java/nl/enjarai/doabarrelroll/config/ModConfigServer.java @@ -3,7 +3,6 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import io.netty.buffer.ByteBuf; -import net.minecraft.network.PacketByteBuf; import net.minecraft.network.codec.PacketCodec; import net.minecraft.network.codec.PacketCodecs; import net.minecraft.server.network.ServerPlayNetworkHandler; @@ -11,7 +10,6 @@ import nl.enjarai.doabarrelroll.DoABarrelRoll; import nl.enjarai.doabarrelroll.net.SyncableConfig; import nl.enjarai.doabarrelroll.net.ValidatableConfig; -import nl.enjarai.doabarrelroll.platform.Services; public record ModConfigServer(boolean allowThrusting, boolean forceEnabled, @@ -49,12 +47,12 @@ public Text getSyncTimeoutMessage() { @Override public LimitedModConfigServer getLimited(ServerPlayNetworkHandler handler) { - return Services.PLATFORM.checkPermission(handler, DoABarrelRoll.MODID + ".ignore_config", 2) + return DoABarrelRoll.checkPermission(handler, DoABarrelRoll.MODID + ".ignore_config", 2) ? LimitedModConfigServer.OPERATOR : this; } public static boolean canModify(ServerPlayNetworkHandler net) { - return Services.PLATFORM.checkPermission(net, DoABarrelRoll.MODID + ".configure", 3); + return DoABarrelRoll.checkPermission(net, DoABarrelRoll.MODID + ".configure", 3); } @Override diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/config/MutableConfigServer.java b/src/main/java/nl/enjarai/doabarrelroll/config/MutableConfigServer.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/config/MutableConfigServer.java rename to src/main/java/nl/enjarai/doabarrelroll/config/MutableConfigServer.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/config/Sensitivity.java b/src/main/java/nl/enjarai/doabarrelroll/config/Sensitivity.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/config/Sensitivity.java rename to src/main/java/nl/enjarai/doabarrelroll/config/Sensitivity.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/config/serialization/ExpressionParserTypeAdapter.java b/src/main/java/nl/enjarai/doabarrelroll/config/serialization/ExpressionParserTypeAdapter.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/config/serialization/ExpressionParserTypeAdapter.java rename to src/main/java/nl/enjarai/doabarrelroll/config/serialization/ExpressionParserTypeAdapter.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/flight/RotationModifiers.java b/src/main/java/nl/enjarai/doabarrelroll/flight/RotationModifiers.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/flight/RotationModifiers.java rename to src/main/java/nl/enjarai/doabarrelroll/flight/RotationModifiers.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/impl/event/EventImpl.java b/src/main/java/nl/enjarai/doabarrelroll/impl/event/EventImpl.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/impl/event/EventImpl.java rename to src/main/java/nl/enjarai/doabarrelroll/impl/event/EventImpl.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/impl/event/RollContextImpl.java b/src/main/java/nl/enjarai/doabarrelroll/impl/event/RollContextImpl.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/impl/event/RollContextImpl.java rename to src/main/java/nl/enjarai/doabarrelroll/impl/event/RollContextImpl.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/impl/event/RollGroupImpl.java b/src/main/java/nl/enjarai/doabarrelroll/impl/event/RollGroupImpl.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/impl/event/RollGroupImpl.java rename to src/main/java/nl/enjarai/doabarrelroll/impl/event/RollGroupImpl.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/impl/key/InputContextImpl.java b/src/main/java/nl/enjarai/doabarrelroll/impl/key/InputContextImpl.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/impl/key/InputContextImpl.java rename to src/main/java/nl/enjarai/doabarrelroll/impl/key/InputContextImpl.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/impl/rotation/RotationInstantImpl.java b/src/main/java/nl/enjarai/doabarrelroll/impl/rotation/RotationInstantImpl.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/impl/rotation/RotationInstantImpl.java rename to src/main/java/nl/enjarai/doabarrelroll/impl/rotation/RotationInstantImpl.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/math/Expression.java b/src/main/java/nl/enjarai/doabarrelroll/math/Expression.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/math/Expression.java rename to src/main/java/nl/enjarai/doabarrelroll/math/Expression.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/math/ExpressionParser.java b/src/main/java/nl/enjarai/doabarrelroll/math/ExpressionParser.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/math/ExpressionParser.java rename to src/main/java/nl/enjarai/doabarrelroll/math/ExpressionParser.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/math/MagicNumbers.java b/src/main/java/nl/enjarai/doabarrelroll/math/MagicNumbers.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/math/MagicNumbers.java rename to src/main/java/nl/enjarai/doabarrelroll/math/MagicNumbers.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/math/Parser.java b/src/main/java/nl/enjarai/doabarrelroll/math/Parser.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/math/Parser.java rename to src/main/java/nl/enjarai/doabarrelroll/math/Parser.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/math/SyntaxHighlighter.java b/src/main/java/nl/enjarai/doabarrelroll/math/SyntaxHighlighter.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/math/SyntaxHighlighter.java rename to src/main/java/nl/enjarai/doabarrelroll/math/SyntaxHighlighter.java diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/mixin/fabric/CommandManagerMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/CommandManagerMixin.java similarity index 94% rename from fabric/src/main/java/nl/enjarai/doabarrelroll/mixin/fabric/CommandManagerMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/CommandManagerMixin.java index 9580f747..76d2833f 100644 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/mixin/fabric/CommandManagerMixin.java +++ b/src/main/java/nl/enjarai/doabarrelroll/mixin/CommandManagerMixin.java @@ -1,4 +1,4 @@ -package nl.enjarai.doabarrelroll.mixin.fabric; +package nl.enjarai.doabarrelroll.mixin; import net.minecraft.server.command.CommandManager; import net.minecraft.server.network.ServerPlayerEntity; diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/LivingEntityMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/LivingEntityMixin.java similarity index 85% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/LivingEntityMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/LivingEntityMixin.java index 59fb5c06..0a50e011 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/LivingEntityMixin.java +++ b/src/main/java/nl/enjarai/doabarrelroll/mixin/LivingEntityMixin.java @@ -1,8 +1,7 @@ package nl.enjarai.doabarrelroll.mixin; import net.minecraft.entity.LivingEntity; -import nl.enjarai.doabarrelroll.DoABarrelRoll; -import nl.enjarai.doabarrelroll.platform.Services; +import nl.enjarai.doabarrelroll.net.ServerNetworking; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; @@ -24,7 +23,7 @@ public abstract class LivingEntityMixin { require = 0 // We let this mixin fail if it needs to as a temporary workaround to be compatible with Connector. ) private float doABarrelRoll$modifyKineticDamage(float original) { - var damageType = Services.SERVER_NET.getServerConfigHolder().instance.kineticDamage(); + var damageType = ServerNetworking.CONFIG_HOLDER.instance.kineticDamage(); return switch (damageType) { case VANILLA -> original; diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/ClientPlayerEntityMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/ClientPlayerEntityMixin.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/ClientPlayerEntityMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/client/ClientPlayerEntityMixin.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/InGameHudMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/InGameHudMixin.java similarity index 88% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/InGameHudMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/client/InGameHudMixin.java index 1b69f477..b0cc9be8 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/InGameHudMixin.java +++ b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/InGameHudMixin.java @@ -38,7 +38,10 @@ public abstract class InGameHudMixin { method = "render", at = @At( value = "INVOKE", + //? if fabric { target = "Lnet/minecraft/client/gui/LayeredDrawer;render(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/client/render/RenderTickCounter;)V" + //?} else + /*target = "Lnet/neoforged/neoforge/client/gui/GuiLayerManager;render(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/client/render/RenderTickCounter;)V"*/ ) ) private void doABarrelRoll$renderPeppy(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) { diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/LivingEntityMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/LivingEntityMixin.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/LivingEntityMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/client/LivingEntityMixin.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/PlayerEntityMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/PlayerEntityMixin.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/PlayerEntityMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/client/PlayerEntityMixin.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingAccessor.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingAccessor.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingAccessor.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingAccessor.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingEntryMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingEntryMixin.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingEntryMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingEntryMixin.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingMixin.java similarity index 99% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingMixin.java index c48a20ea..63b91a08 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingMixin.java +++ b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/key/KeyBindingMixin.java @@ -48,6 +48,8 @@ private static KeyBinding getContextKeyBinding(InputUtil.Key key) { return null; } + //? if fabric { + @WrapOperation( method = "onKeyPressed", at = @At( @@ -106,4 +108,5 @@ private static KeyBinding getContextKeyBinding(InputUtil.Key key) { private static boolean doABarrelRoll$skipAddingContextualKeys(Map map, Object key, Object keyBinding) { return !InputContextImpl.contextsContain((KeyBinding) keyBinding); } + //?} } diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/CameraMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/CameraMixin.java similarity index 74% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/CameraMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/CameraMixin.java index f548a398..c3b8efab 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/CameraMixin.java +++ b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/CameraMixin.java @@ -1,6 +1,6 @@ package nl.enjarai.doabarrelroll.mixin.client.roll; -import com.llamalad7.mixinextras.injector.WrapWithCondition; +import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.llamalad7.mixinextras.sugar.Share; import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef; import net.minecraft.client.render.Camera; @@ -28,10 +28,15 @@ public abstract class CameraMixin implements RollCamera { private float lastRollBack; @Unique private float rollBack; + //? if fabric { @Unique private float roll; @Unique private final ThreadLocal tempRoll = new ThreadLocal<>(); + //?} else { + /*@Shadow + private float roll; + *///?} @Inject( method = "updateEyeHeight", @@ -68,6 +73,7 @@ public abstract class CameraMixin implements RollCamera { } } + //? if fabric { @WrapWithCondition( method = "update", at = @At( @@ -124,10 +130,46 @@ public abstract class CameraMixin implements RollCamera { var roll = tempRoll.get(); if (roll != null) { this.roll = roll; - return (float) (this.roll * MagicNumbers.TORAD); + return (float) (this.roll * MagicNumbers.TORAD) + original; } return original; } + //?} else { + /*@ModifyArg( + method = "update", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/render/Camera;setRotation(FFF)V", + ordinal = 0 + ), + index = 2 + ) + private float doABarrelRoll$addRoll2(float original, @Share("tickDelta") LocalFloatRef tickDelta) { + if (isRolling) { + return original + ((RollEntity) focusedEntity).doABarrelRoll$getRoll(tickDelta.get()); + } else { + return original + MathHelper.lerp(tickDelta.get(), lastRollBack, rollBack); + } + } + + @ModifyArg( + method = "update", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/render/Camera;setRotation(FFF)V", + ordinal = 1 + ), + index = 2 + ) + private float doABarrelRoll$addRoll3(float original, @Share("tickDelta") LocalFloatRef tickDelta) { + if (isRolling) { + return original - ((RollEntity) focusedEntity).doABarrelRoll$getRoll(tickDelta.get()); + } else { + return original - MathHelper.lerp(tickDelta.get(), lastRollBack, rollBack); + } + } + *///?} + @Override public float doABarrelRoll$getRoll() { diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/DebugHudMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/DebugHudMixin.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/DebugHudMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/DebugHudMixin.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/MouseMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/MouseMixin.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/MouseMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/MouseMixin.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/PlayerEntityRendererMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/PlayerEntityRendererMixin.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/PlayerEntityRendererMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/PlayerEntityRendererMixin.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/entity/ClientPlayerEntityMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/entity/ClientPlayerEntityMixin.java similarity index 97% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/entity/ClientPlayerEntityMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/entity/ClientPlayerEntityMixin.java index f3a68d8d..95668975 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/entity/ClientPlayerEntityMixin.java +++ b/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/entity/ClientPlayerEntityMixin.java @@ -8,7 +8,7 @@ import nl.enjarai.doabarrelroll.flight.RotationModifiers; import nl.enjarai.doabarrelroll.math.MagicNumbers; import nl.enjarai.doabarrelroll.mixin.roll.entity.PlayerEntityMixin; -import nl.enjarai.doabarrelroll.platform.Services; +import nl.enjarai.doabarrelroll.net.ClientNetworking; import org.joml.Vector3d; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -35,7 +35,7 @@ public abstract class ClientPlayerEntityMixin extends PlayerEntityMixin { var isRolling = doABarrelRoll$isRolling(); var rollDiff = doABarrelRoll$getRoll() - lastSentRoll; if (isRolling != lastSentIsRolling || rollDiff != 0.0f) { - Services.CLIENT_NET.sendRollUpdate(this); + ClientNetworking.sendRollUpdate(this); lastSentIsRolling = isRolling; lastSentRoll = doABarrelRoll$getRoll(); diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/EntityTrackerEntryMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/EntityTrackerEntryMixin.java similarity index 91% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/EntityTrackerEntryMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/roll/EntityTrackerEntryMixin.java index 76e89922..ba7722e0 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/EntityTrackerEntryMixin.java +++ b/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/EntityTrackerEntryMixin.java @@ -3,7 +3,7 @@ import net.minecraft.entity.Entity; import net.minecraft.server.network.EntityTrackerEntry; import nl.enjarai.doabarrelroll.api.RollEntity; -import nl.enjarai.doabarrelroll.platform.Services; +import nl.enjarai.doabarrelroll.net.ServerNetworking; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -31,7 +31,7 @@ public abstract class EntityTrackerEntryMixin { var roll = rollEntity.doABarrelRoll$getRoll(); if (isRolling != lastIsRolling || roll != lastRoll) { - Services.SERVER_NET.sendRollUpdates(entity); + ServerNetworking.sendRollUpdates(entity); lastIsRolling = isRolling; lastRoll = roll; diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/entity/EntityMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/entity/EntityMixin.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/entity/EntityMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/roll/entity/EntityMixin.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/entity/LivingEntityMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/entity/LivingEntityMixin.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/entity/LivingEntityMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/roll/entity/LivingEntityMixin.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/entity/PlayerEntityMixin.java b/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/entity/PlayerEntityMixin.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/mixin/roll/entity/PlayerEntityMixin.java rename to src/main/java/nl/enjarai/doabarrelroll/mixin/roll/entity/PlayerEntityMixin.java diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/ClientNetworking.java b/src/main/java/nl/enjarai/doabarrelroll/net/ClientNetworking.java similarity index 78% rename from fabric/src/main/java/nl/enjarai/doabarrelroll/net/ClientNetworking.java rename to src/main/java/nl/enjarai/doabarrelroll/net/ClientNetworking.java index 1a205ba6..f0fc04da 100644 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/ClientNetworking.java +++ b/src/main/java/nl/enjarai/doabarrelroll/net/ClientNetworking.java @@ -4,31 +4,28 @@ import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.minecraft.client.MinecraftClient; import net.minecraft.util.math.MathHelper; -import nl.enjarai.doabarrelroll.DoABarrelRoll; -import nl.enjarai.doabarrelroll.DoABarrelRollClient; import nl.enjarai.doabarrelroll.api.RollEntity; import nl.enjarai.doabarrelroll.api.event.ClientEvents; import nl.enjarai.doabarrelroll.config.ModConfigServer; import nl.enjarai.doabarrelroll.net.packet.*; -import nl.enjarai.doabarrelroll.platform.Services; public class ClientNetworking { - public static final HandshakeClient HANDSHAKE_CLIENT = new HandshakeClient<>( - ConfigResponseC2SPacketImpl::new, + public static final HandshakeClient HANDSHAKE_CLIENT = new HandshakeClient<>( + ConfigResponseC2SPacket::new, ClientEvents::updateServerConfig ); - public static final ServerConfigUpdateClient CONFIG_UPDATE_CLIENT = new ServerConfigUpdateClient<>( - ConfigUpdateC2SPacketImpl::new + public static final ServerConfigUpdateClient CONFIG_UPDATE_CLIENT = new ServerConfigUpdateClient<>( + ConfigUpdateC2SPacket::new ); public static void init() { - ClientPlayNetworking.registerGlobalReceiver(ConfigSyncS2CPacketImpl.PACKET_ID, (payload, context) -> { + ClientPlayNetworking.registerGlobalReceiver(ConfigSyncS2CPacket.PACKET_ID, (payload, context) -> { var response = HANDSHAKE_CLIENT.handleConfigSync(payload); context.responseSender().sendPacket(response); if (HANDSHAKE_CLIENT.hasConnected()) { // Initialize roll sync - ClientPlayNetworking.registerReceiver(RollSyncS2CPacketImpl.PACKET_ID, (payload1, context1) -> { + ClientPlayNetworking.registerReceiver(RollSyncS2CPacket.PACKET_ID, (payload1, context1) -> { var client = MinecraftClient.getInstance(); if (client.world == null) { return; @@ -45,7 +42,7 @@ public static void init() { }); // Initialize config update ack listener - ClientPlayNetworking.registerReceiver(ConfigUpdateAckS2CPacketImpl.PACKET_ID, (payload1, context1) -> { + ClientPlayNetworking.registerReceiver(ConfigUpdateAckS2CPacket.PACKET_ID, (payload1, context1) -> { CONFIG_UPDATE_CLIENT.updateAcknowledged(payload1); }); } @@ -59,7 +56,7 @@ public static void sendRollUpdate(RollEntity entity) { boolean rolling = entity.doABarrelRoll$isRolling(); float roll = entity.doABarrelRoll$getRoll(); - ClientPlayNetworking.send(new RollSyncC2SPacketImpl(rolling, roll)); + ClientPlayNetworking.send(new RollSyncC2SPacket(rolling, roll)); } } diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/net/HandshakeClient.java b/src/main/java/nl/enjarai/doabarrelroll/net/HandshakeClient.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/net/HandshakeClient.java rename to src/main/java/nl/enjarai/doabarrelroll/net/HandshakeClient.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/net/HandshakeServer.java b/src/main/java/nl/enjarai/doabarrelroll/net/HandshakeServer.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/net/HandshakeServer.java rename to src/main/java/nl/enjarai/doabarrelroll/net/HandshakeServer.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/net/ServerConfigHolder.java b/src/main/java/nl/enjarai/doabarrelroll/net/ServerConfigHolder.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/net/ServerConfigHolder.java rename to src/main/java/nl/enjarai/doabarrelroll/net/ServerConfigHolder.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/net/ServerConfigUpdateClient.java b/src/main/java/nl/enjarai/doabarrelroll/net/ServerConfigUpdateClient.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/net/ServerConfigUpdateClient.java rename to src/main/java/nl/enjarai/doabarrelroll/net/ServerConfigUpdateClient.java diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/ServerNetworking.java b/src/main/java/nl/enjarai/doabarrelroll/net/ServerNetworking.java similarity index 79% rename from fabric/src/main/java/nl/enjarai/doabarrelroll/net/ServerNetworking.java rename to src/main/java/nl/enjarai/doabarrelroll/net/ServerNetworking.java index 01c9ed2f..89d706c9 100644 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/ServerNetworking.java +++ b/src/main/java/nl/enjarai/doabarrelroll/net/ServerNetworking.java @@ -14,35 +14,34 @@ import nl.enjarai.doabarrelroll.api.event.ServerEvents; import nl.enjarai.doabarrelroll.config.ModConfigServer; import nl.enjarai.doabarrelroll.net.packet.*; -import nl.enjarai.doabarrelroll.platform.Services; public class ServerNetworking { - public static final ServerConfigHolder CONFIG_HOLDER = new ServerConfigHolder<>( + public static final ServerConfigHolder CONFIG_HOLDER = new ServerConfigHolder<>( FabricLoader.getInstance().getConfigDir().resolve(DoABarrelRoll.MODID + "-server.json"), - ModConfigServer.CODEC, ConfigUpdateAckS2CPacketImpl::new, ServerEvents::updateServerConfig + ModConfigServer.CODEC, ConfigUpdateAckS2CPacket::new, ServerEvents::updateServerConfig ); - public static final HandshakeServer HANDSHAKE_SERVER = new HandshakeServer<>( - ConfigSyncS2CPacketImpl::new, CONFIG_HOLDER, player -> !ModConfigServer.canModify(player)); + public static final HandshakeServer HANDSHAKE_SERVER = new HandshakeServer<>( + ConfigSyncS2CPacket::new, CONFIG_HOLDER, player -> !ModConfigServer.canModify(player)); public static void init() { CONFIG_HOLDER.setHandshakeServer(HANDSHAKE_SERVER); - PayloadTypeRegistry.playC2S().register(ConfigResponseC2SPacketImpl.PACKET_ID, ConfigResponseC2SPacketImpl.PACKET_CODEC); - PayloadTypeRegistry.playC2S().register(ConfigUpdateC2SPacketImpl.PACKET_ID, ConfigUpdateC2SPacketImpl.PACKET_CODEC); - PayloadTypeRegistry.playC2S().register(RollSyncC2SPacketImpl.PACKET_ID, RollSyncC2SPacketImpl.PACKET_CODEC); + PayloadTypeRegistry.playC2S().register(ConfigResponseC2SPacket.PACKET_ID, ConfigResponseC2SPacket.PACKET_CODEC); + PayloadTypeRegistry.playC2S().register(ConfigUpdateC2SPacket.PACKET_ID, ConfigUpdateC2SPacket.PACKET_CODEC); + PayloadTypeRegistry.playC2S().register(RollSyncC2SPacket.PACKET_ID, RollSyncC2SPacket.PACKET_CODEC); - PayloadTypeRegistry.playS2C().register(ConfigSyncS2CPacketImpl.PACKET_ID, ConfigSyncS2CPacketImpl.PACKET_CODEC); - PayloadTypeRegistry.playS2C().register(ConfigUpdateAckS2CPacketImpl.PACKET_ID, ConfigUpdateAckS2CPacketImpl.PACKET_CODEC); - PayloadTypeRegistry.playS2C().register(RollSyncS2CPacketImpl.PACKET_ID, RollSyncS2CPacketImpl.PACKET_CODEC); + PayloadTypeRegistry.playS2C().register(ConfigSyncS2CPacket.PACKET_ID, ConfigSyncS2CPacket.PACKET_CODEC); + PayloadTypeRegistry.playS2C().register(ConfigUpdateAckS2CPacket.PACKET_ID, ConfigUpdateAckS2CPacket.PACKET_CODEC); + PayloadTypeRegistry.playS2C().register(RollSyncS2CPacket.PACKET_ID, RollSyncS2CPacket.PACKET_CODEC); - ServerPlayNetworking.registerGlobalReceiver(ConfigResponseC2SPacketImpl.PACKET_ID, (payload, context) -> { + ServerPlayNetworking.registerGlobalReceiver(ConfigResponseC2SPacket.PACKET_ID, (payload, context) -> { var reply = HANDSHAKE_SERVER.clientReplied(context.player().networkHandler, payload); if (reply == HandshakeServer.HandshakeState.RESEND) { // Resending can happen when the client has a different protocol version than expected. sendHandshake(context.player()); } else if (reply == HandshakeServer.HandshakeState.ACCEPTED) { // Init roll syncing - ServerPlayNetworking.registerReceiver(context.player().networkHandler, RollSyncC2SPacketImpl.PACKET_ID, (payload1, context1) -> { + ServerPlayNetworking.registerReceiver(context.player().networkHandler, RollSyncC2SPacket.PACKET_ID, (payload1, context1) -> { var rollPlayer = (RollEntity) context1.player(); var isRolling = payload1.rolling(); @@ -53,7 +52,7 @@ public static void init() { }); // Init client -> server config update - ServerPlayNetworking.registerReceiver(context.player().networkHandler, ConfigUpdateC2SPacketImpl.PACKET_ID, (payload1, context1) -> { + ServerPlayNetworking.registerReceiver(context.player().networkHandler, ConfigUpdateC2SPacket.PACKET_ID, (payload1, context1) -> { context1.responseSender().sendPacket(CONFIG_HOLDER.clientSendsUpdate(context1.player(), payload1)); }); } @@ -82,7 +81,7 @@ public static void sendRollUpdates(Entity entity) { var isRolling = rollEntity.doABarrelRoll$isRolling(); var roll = rollEntity.doABarrelRoll$getRoll(); - var payload = new RollSyncS2CPacketImpl(entity.getId(), isRolling, roll); + var payload = new RollSyncS2CPacket(entity.getId(), isRolling, roll); PlayerLookup.tracking(entity).stream() .filter(player -> player != entity) diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/net/SyncableConfig.java b/src/main/java/nl/enjarai/doabarrelroll/net/SyncableConfig.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/net/SyncableConfig.java rename to src/main/java/nl/enjarai/doabarrelroll/net/SyncableConfig.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/net/ValidatableConfig.java b/src/main/java/nl/enjarai/doabarrelroll/net/ValidatableConfig.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/net/ValidatableConfig.java rename to src/main/java/nl/enjarai/doabarrelroll/net/ValidatableConfig.java diff --git a/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigResponseC2SPacket.java b/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigResponseC2SPacket.java new file mode 100644 index 00000000..7d2ea83f --- /dev/null +++ b/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigResponseC2SPacket.java @@ -0,0 +1,21 @@ +package nl.enjarai.doabarrelroll.net.packet; + +import io.netty.buffer.ByteBuf; +import net.minecraft.network.codec.PacketCodec; +import net.minecraft.network.codec.PacketCodecs; +import net.minecraft.network.packet.CustomPayload; +import nl.enjarai.doabarrelroll.DoABarrelRoll; + +public record ConfigResponseC2SPacket(int protocolVersion, boolean success) implements CustomPayload { + public static final Id PACKET_ID = new Id<>(DoABarrelRoll.id("config_response")); + public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( + PacketCodecs.INTEGER, ConfigResponseC2SPacket::protocolVersion, + PacketCodecs.BOOL, ConfigResponseC2SPacket::success, + ConfigResponseC2SPacket::new + ); + + @Override + public Id getId() { + return PACKET_ID; + } +} diff --git a/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigSyncS2CPacket.java b/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigSyncS2CPacket.java new file mode 100644 index 00000000..6c6e8fd8 --- /dev/null +++ b/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigSyncS2CPacket.java @@ -0,0 +1,25 @@ +package nl.enjarai.doabarrelroll.net.packet; + +import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.codec.PacketCodec; +import net.minecraft.network.codec.PacketCodecs; +import net.minecraft.network.packet.CustomPayload; +import nl.enjarai.doabarrelroll.DoABarrelRoll; +import nl.enjarai.doabarrelroll.config.LimitedModConfigServer; +import nl.enjarai.doabarrelroll.config.ModConfigServer; + +public record ConfigSyncS2CPacket(int protocolVersion, LimitedModConfigServer applicableConfig, boolean isLimited, ModConfigServer fullConfig) implements CustomPayload { + public static final Id PACKET_ID = new Id<>(DoABarrelRoll.id("config_sync")); + public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( + PacketCodecs.INTEGER, ConfigSyncS2CPacket::protocolVersion, + LimitedModConfigServer.getPacketCodec(), ConfigSyncS2CPacket::applicableConfig, + PacketCodecs.BOOL, ConfigSyncS2CPacket::isLimited, + ModConfigServer.PACKET_CODEC, ConfigSyncS2CPacket::fullConfig, + ConfigSyncS2CPacket::new + ); + + @Override + public Id getId() { + return PACKET_ID; + } +} diff --git a/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateAckS2CPacket.java b/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateAckS2CPacket.java new file mode 100644 index 00000000..7be9fe72 --- /dev/null +++ b/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateAckS2CPacket.java @@ -0,0 +1,21 @@ +package nl.enjarai.doabarrelroll.net.packet; + +import io.netty.buffer.ByteBuf; +import net.minecraft.network.codec.PacketCodec; +import net.minecraft.network.codec.PacketCodecs; +import net.minecraft.network.packet.CustomPayload; +import nl.enjarai.doabarrelroll.DoABarrelRoll; + +public record ConfigUpdateAckS2CPacket(int protocolVersion, boolean success) implements CustomPayload { + public static final Id PACKET_ID = new Id<>(DoABarrelRoll.id("config_update_ack")); + public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( + PacketCodecs.INTEGER, ConfigUpdateAckS2CPacket::protocolVersion, + PacketCodecs.BOOL, ConfigUpdateAckS2CPacket::success, + ConfigUpdateAckS2CPacket::new + ); + + @Override + public Id getId() { + return PACKET_ID; + } +} diff --git a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateC2SPacketImpl.java b/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateC2SPacket.java similarity index 50% rename from fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateC2SPacketImpl.java rename to src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateC2SPacket.java index 72b7dadf..6bc8afae 100644 --- a/fabric/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateC2SPacketImpl.java +++ b/src/main/java/nl/enjarai/doabarrelroll/net/packet/ConfigUpdateC2SPacket.java @@ -7,12 +7,12 @@ import nl.enjarai.doabarrelroll.DoABarrelRoll; import nl.enjarai.doabarrelroll.config.ModConfigServer; -public record ConfigUpdateC2SPacketImpl(int protocolVersion, ModConfigServer config) implements CustomPayload, ConfigUpdateC2SPacket { - public static final Id PACKET_ID = new Id<>(DoABarrelRoll.id("config_update")); - public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( - PacketCodecs.INTEGER, ConfigUpdateC2SPacketImpl::protocolVersion, - ModConfigServer.PACKET_CODEC, ConfigUpdateC2SPacketImpl::config, - ConfigUpdateC2SPacketImpl::new +public record ConfigUpdateC2SPacket(int protocolVersion, ModConfigServer config) implements CustomPayload { + public static final Id PACKET_ID = new Id<>(DoABarrelRoll.id("config_update")); + public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( + PacketCodecs.INTEGER, ConfigUpdateC2SPacket::protocolVersion, + ModConfigServer.PACKET_CODEC, ConfigUpdateC2SPacket::config, + ConfigUpdateC2SPacket::new ); @Override diff --git a/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncC2SPacket.java b/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncC2SPacket.java new file mode 100644 index 00000000..ad3419cb --- /dev/null +++ b/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncC2SPacket.java @@ -0,0 +1,21 @@ +package nl.enjarai.doabarrelroll.net.packet; + +import io.netty.buffer.ByteBuf; +import net.minecraft.network.codec.PacketCodec; +import net.minecraft.network.codec.PacketCodecs; +import net.minecraft.network.packet.CustomPayload; +import nl.enjarai.doabarrelroll.DoABarrelRoll; + +public record RollSyncC2SPacket(boolean rolling, float roll) implements CustomPayload { + public static final Id PACKET_ID = new Id<>(DoABarrelRoll.id("roll_sync")); + public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( + PacketCodecs.BOOL, RollSyncC2SPacket::rolling, + PacketCodecs.FLOAT, RollSyncC2SPacket::roll, + RollSyncC2SPacket::new + ); + + @Override + public Id getId() { + return PACKET_ID; + } +} diff --git a/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncS2CPacket.java b/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncS2CPacket.java new file mode 100644 index 00000000..5c83f1a0 --- /dev/null +++ b/src/main/java/nl/enjarai/doabarrelroll/net/packet/RollSyncS2CPacket.java @@ -0,0 +1,22 @@ +package nl.enjarai.doabarrelroll.net.packet; + +import io.netty.buffer.ByteBuf; +import net.minecraft.network.codec.PacketCodec; +import net.minecraft.network.codec.PacketCodecs; +import net.minecraft.network.packet.CustomPayload; +import nl.enjarai.doabarrelroll.DoABarrelRoll; + +public record RollSyncS2CPacket(int entityId, boolean rolling, float roll) implements CustomPayload { + public static final Id PACKET_ID = new Id<>(DoABarrelRoll.id("roll_sync")); + public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( + PacketCodecs.INTEGER, RollSyncS2CPacket::entityId, + PacketCodecs.BOOL, RollSyncS2CPacket::rolling, + PacketCodecs.FLOAT, RollSyncS2CPacket::roll, + RollSyncS2CPacket::new + ); + + @Override + public Id getId() { + return PACKET_ID; + } +} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/render/HorizonLineWidget.java b/src/main/java/nl/enjarai/doabarrelroll/render/HorizonLineWidget.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/render/HorizonLineWidget.java rename to src/main/java/nl/enjarai/doabarrelroll/render/HorizonLineWidget.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/render/MomentumCrosshairWidget.java b/src/main/java/nl/enjarai/doabarrelroll/render/MomentumCrosshairWidget.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/render/MomentumCrosshairWidget.java rename to src/main/java/nl/enjarai/doabarrelroll/render/MomentumCrosshairWidget.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/render/RenderHelper.java b/src/main/java/nl/enjarai/doabarrelroll/render/RenderHelper.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/render/RenderHelper.java rename to src/main/java/nl/enjarai/doabarrelroll/render/RenderHelper.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/util/DelayedRunnable.java b/src/main/java/nl/enjarai/doabarrelroll/util/DelayedRunnable.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/util/DelayedRunnable.java rename to src/main/java/nl/enjarai/doabarrelroll/util/DelayedRunnable.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/util/MixinHooks.java b/src/main/java/nl/enjarai/doabarrelroll/util/MixinHooks.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/util/MixinHooks.java rename to src/main/java/nl/enjarai/doabarrelroll/util/MixinHooks.java diff --git a/neoforge/src/main/java/nl/enjarai/doabarrelroll/ModPermissions.java b/src/main/java/nl/enjarai/doabarrelroll/util/ModPermissions.java similarity index 95% rename from neoforge/src/main/java/nl/enjarai/doabarrelroll/ModPermissions.java rename to src/main/java/nl/enjarai/doabarrelroll/util/ModPermissions.java index c60cb87b..486f3387 100644 --- a/neoforge/src/main/java/nl/enjarai/doabarrelroll/ModPermissions.java +++ b/src/main/java/nl/enjarai/doabarrelroll/util/ModPermissions.java @@ -1,4 +1,5 @@ -package nl.enjarai.doabarrelroll; +//? if !fabric { +/*package nl.enjarai.doabarrelroll.util; import net.minecraft.server.network.ServerPlayerEntity; import net.neoforged.neoforge.server.permission.PermissionAPI; @@ -6,6 +7,7 @@ import net.neoforged.neoforge.server.permission.nodes.PermissionDynamicContextKey; import net.neoforged.neoforge.server.permission.nodes.PermissionNode; import net.neoforged.neoforge.server.permission.nodes.PermissionTypes; +import nl.enjarai.doabarrelroll.DoABarrelRoll; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -54,3 +56,4 @@ private static boolean defaultResolve(@Nullable ServerPlayerEntity player, UUID // }; // } } +*///?} diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/util/StarFoxUtil.java b/src/main/java/nl/enjarai/doabarrelroll/util/StarFoxUtil.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/util/StarFoxUtil.java rename to src/main/java/nl/enjarai/doabarrelroll/util/StarFoxUtil.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/util/ToastUtil.java b/src/main/java/nl/enjarai/doabarrelroll/util/ToastUtil.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/util/ToastUtil.java rename to src/main/java/nl/enjarai/doabarrelroll/util/ToastUtil.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/util/Value.java b/src/main/java/nl/enjarai/doabarrelroll/util/Value.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/util/Value.java rename to src/main/java/nl/enjarai/doabarrelroll/util/Value.java diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/util/key/ContextualKeyBinding.java b/src/main/java/nl/enjarai/doabarrelroll/util/key/ContextualKeyBinding.java similarity index 100% rename from common/src/main/java/nl/enjarai/doabarrelroll/util/key/ContextualKeyBinding.java rename to src/main/java/nl/enjarai/doabarrelroll/util/key/ContextualKeyBinding.java diff --git a/neoforge/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg similarity index 100% rename from neoforge/src/main/resources/META-INF/accesstransformer.cfg rename to src/main/resources/META-INF/accesstransformer.cfg diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml new file mode 100644 index 00000000..26b1a7f8 --- /dev/null +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,35 @@ +modLoader = "javafml" +loaderVersion = "[1,)" +license = "GPL-3.0" + +issueTrackerURL = "https://github.com/enjarai/do-a-barrel-roll/issues" + +[[mods]] +modId = "do_a_barrel_roll" +version = "${version}" +displayName = "Do a Barrel Roll" +displayURL = "https://modrinth.com/mod/do-a-barrel-roll" +authors = "enjarai" +description = ''' +Microsoft flight simulator for Minecraft elytras. +''' +logoFile = "assets/do_a_barrel_roll/icon.png" + +[[mixins]] +config = "do_a_barrel_roll.mixins.json" + +[[accessTransformers]] +file = "META-INF/accesstransformer.cfg" + +[[dependencies.do_a_barrel_roll]] +modId = "minecraft" +mandatory = true +versionRange = "${mc}" +ordering = "NONE" +side = "BOTH" + +[[dependencies.do_a_barrel_roll]] +modId = "fabric_api" +mandatory = true +ordering = "NONE" +side = "BOTH" \ No newline at end of file diff --git a/fabric/src/main/resources/assets/controlify/controllers/default_bind/default.json b/src/main/resources/assets/controlify/controllers/default_bind/default.json similarity index 100% rename from fabric/src/main/resources/assets/controlify/controllers/default_bind/default.json rename to src/main/resources/assets/controlify/controllers/default_bind/default.json diff --git a/common/src/main/resources/assets/do_a_barrel_roll/icon.png b/src/main/resources/assets/do_a_barrel_roll/icon.png similarity index 100% rename from common/src/main/resources/assets/do_a_barrel_roll/icon.png rename to src/main/resources/assets/do_a_barrel_roll/icon.png diff --git a/common/src/main/resources/assets/do_a_barrel_roll/lang/en_us.yml b/src/main/resources/assets/do_a_barrel_roll/lang/en_us.yml similarity index 100% rename from common/src/main/resources/assets/do_a_barrel_roll/lang/en_us.yml rename to src/main/resources/assets/do_a_barrel_roll/lang/en_us.yml diff --git a/common/src/main/resources/assets/do_a_barrel_roll/lang/es_mx.yml b/src/main/resources/assets/do_a_barrel_roll/lang/es_mx.yml similarity index 100% rename from common/src/main/resources/assets/do_a_barrel_roll/lang/es_mx.yml rename to src/main/resources/assets/do_a_barrel_roll/lang/es_mx.yml diff --git a/common/src/main/resources/assets/do_a_barrel_roll/lang/pt_br.yml b/src/main/resources/assets/do_a_barrel_roll/lang/pt_br.yml similarity index 100% rename from common/src/main/resources/assets/do_a_barrel_roll/lang/pt_br.yml rename to src/main/resources/assets/do_a_barrel_roll/lang/pt_br.yml diff --git a/common/src/main/resources/assets/do_a_barrel_roll/sounds.json b/src/main/resources/assets/do_a_barrel_roll/sounds.json similarity index 100% rename from common/src/main/resources/assets/do_a_barrel_roll/sounds.json rename to src/main/resources/assets/do_a_barrel_roll/sounds.json diff --git a/common/src/main/resources/assets/do_a_barrel_roll/sounds/do_a_barrel_roll.ogg b/src/main/resources/assets/do_a_barrel_roll/sounds/do_a_barrel_roll.ogg similarity index 100% rename from common/src/main/resources/assets/do_a_barrel_roll/sounds/do_a_barrel_roll.ogg rename to src/main/resources/assets/do_a_barrel_roll/sounds/do_a_barrel_roll.ogg diff --git a/common/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_1.png b/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_1.png similarity index 100% rename from common/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_1.png rename to src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_1.png diff --git a/common/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_2.png b/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_2.png similarity index 100% rename from common/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_2.png rename to src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_2.png diff --git a/common/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/controls/show_momentum_widget.png b/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/controls/show_momentum_widget.png similarity index 100% rename from common/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/controls/show_momentum_widget.png rename to src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/controls/show_momentum_widget.png diff --git a/common/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/hud/show_horizon.png b/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/hud/show_horizon.png similarity index 100% rename from common/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/hud/show_horizon.png rename to src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/hud/show_horizon.png diff --git a/fabric/src/main/resources/cicada/do_a_barrel_roll/conversations.json b/src/main/resources/cicada/do_a_barrel_roll/conversations.json similarity index 100% rename from fabric/src/main/resources/cicada/do_a_barrel_roll/conversations.json rename to src/main/resources/cicada/do_a_barrel_roll/conversations.json diff --git a/common/src/main/resources/do_a_barrel_roll.accesswidener b/src/main/resources/do_a_barrel_roll.accesswidener similarity index 100% rename from common/src/main/resources/do_a_barrel_roll.accesswidener rename to src/main/resources/do_a_barrel_roll.accesswidener diff --git a/fabric/src/main/resources/do_a_barrel_roll.compat.cameraoverhaul.mixins.json b/src/main/resources/do_a_barrel_roll.compat.cameraoverhaul.mixins.json similarity index 100% rename from fabric/src/main/resources/do_a_barrel_roll.compat.cameraoverhaul.mixins.json rename to src/main/resources/do_a_barrel_roll.compat.cameraoverhaul.mixins.json diff --git a/fabric/src/main/resources/do_a_barrel_roll.compat.modmenu.mixins.json b/src/main/resources/do_a_barrel_roll.compat.modmenu.mixins.json similarity index 100% rename from fabric/src/main/resources/do_a_barrel_roll.compat.modmenu.mixins.json rename to src/main/resources/do_a_barrel_roll.compat.modmenu.mixins.json diff --git a/common/src/main/resources/do_a_barrel_roll.mixins.json b/src/main/resources/do_a_barrel_roll.mixins.json similarity index 96% rename from common/src/main/resources/do_a_barrel_roll.mixins.json rename to src/main/resources/do_a_barrel_roll.mixins.json index a5d083a7..26f2b3bd 100644 --- a/common/src/main/resources/do_a_barrel_roll.mixins.json +++ b/src/main/resources/do_a_barrel_roll.mixins.json @@ -5,6 +5,7 @@ "refmap": "${mod_id}.refmap.json", "compatibilityLevel": "JAVA_17", "mixins": [ + "CommandManagerMixin", "LivingEntityMixin", "roll.EntityTrackerEntryMixin", "roll.entity.EntityMixin", diff --git a/fabric/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json similarity index 57% rename from fabric/src/main/resources/fabric.mod.json rename to src/main/resources/fabric.mod.json index fd432f25..5bef1263 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,29 +1,29 @@ { "schemaVersion": 1, - "id": "${mod_id}", - "version": "${mod_version}", - "name": "${mod_name}", - "description": "${mod_description}", + "id": "do_a_barrel_roll", + "version": "${version}", + "name": "Do a Barrel Roll", + "description": "Microsoft flight simulator for Minecraft elytras.", "authors": [ - "${mod_author}" + "enjarai" ], "contributors": [ - "${mod_credits}" + "Originally based on Cool Elytra Roll by Jorbon, mod icon by Mizeno" ], "contact": { - "homepage": "${mod_url}", - "sources": "https://github.com/${mod_github}", - "issues": "${mod_issue_tracker_url}" + "homepage": "https://enjarai.dev/", + "sources": "https://github.com/enjarai/do-a-barrel-roll", + "issues": "https://github.com/enjarai/do-a-barrel-roll/issues" }, - "license": "${mod_license}", - "icon": "assets/${mod_id}/icon.png", + "license": "GPL-3.0", + "icon": "assets/do_a_barrel_roll/icon.png", "environment": "*", "entrypoints": { "client": [ - "nl.enjarai.doabarrelroll.DoABarrelRollFabricClient" + "nl.enjarai.doabarrelroll.DoABarrelRollInitializer" ], "main": [ - "nl.enjarai.doabarrelroll.DoABarrelRollFabric" + "nl.enjarai.doabarrelroll.DoABarrelRollInitializer" ], "modmenu": [ "nl.enjarai.doabarrelroll.compat.modmenu.ModMenuIntegration" @@ -39,12 +39,11 @@ ] }, "mixins": [ - "${mod_id}.mixins.json", - "${mod_id}.fabric.mixins.json", - "${mod_id}.compat.cameraoverhaul.mixins.json", - "${mod_id}.compat.modmenu.mixins.json" + "do_a_barrel_roll.mixins.json", + "do_a_barrel_roll.compat.cameraoverhaul.mixins.json", + "do_a_barrel_roll.compat.modmenu.mixins.json" ], - "accessWidener": "${mod_id}.accesswidener", + "accessWidener": "do_a_barrel_roll.accesswidener", "suggests": { "yet_another_config_lib_v3": ">=3.1.0" @@ -52,7 +51,7 @@ "depends": { "fabricloader": ">=0.15", "fabric": "*", - "minecraft": "${fabric_minecraft_version_range}", + "minecraft": "${mc}", "java": ">=17", "cicada": ">=0.6.0 <1.0.0" }, diff --git a/common/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta similarity index 100% rename from common/src/main/resources/pack.mcmeta rename to src/main/resources/pack.mcmeta diff --git a/stonecutter.gradle.kts b/stonecutter.gradle.kts new file mode 100644 index 00000000..295858a7 --- /dev/null +++ b/stonecutter.gradle.kts @@ -0,0 +1,32 @@ +plugins { + id("dev.kikugie.stonecutter") + kotlin("jvm") version "2.0.0" apply false + kotlin("plugin.serialization") version "2.0.0" apply false + id("co.uzzu.dotenv.gradle") version "4.0.0" + id("dev.architectury.loom") version "1.7-SNAPSHOT" apply false + id("me.modmuss50.mod-publish-plugin") version "0.5.+" apply false +} +stonecutter active "1.21-fabric" /* [SC] DO NOT EDIT */ + +stonecutter registerChiseled tasks.register("chiseledBuildAndCollect", stonecutter.chiseled) { + group = "project" + ofTask("buildAndCollect") +} + +stonecutter registerChiseled tasks.register("chiseledPublishMods", stonecutter.chiseled) { + group = "project" + ofTask("publishMods") +} + +stonecutter registerChiseled tasks.register("chiseledPublishAll", stonecutter.chiseled) { + group = "project" + ofTask("publishAll") +} + +stonecutter configureEach { + val data = current.project.split('-') + val platforms = listOf("fabric", "forge", "neoforge") + .map { it to (it == data[1]) } + consts(platforms) + swap("mc", "\"${data[0]}\"") +} diff --git a/versions/1.21-fabric/gradle.properties b/versions/1.21-fabric/gradle.properties new file mode 100644 index 00000000..e3257287 --- /dev/null +++ b/versions/1.21-fabric/gradle.properties @@ -0,0 +1,17 @@ +loom.platform=fabric + +# Global +deps.yarn_build=9 +deps.compat=\ + controlify=2.0.0-beta.14+1.21-fabric + +# Fabric +deps.fapi=0.102.0+1.21 +deps.modmenu=11.0.2 +deps.yacl=3.5.0+1.21 +deps.cicada=0.8.0+1.21-and-above + +# Mod +mod.mc_dep=>=1.21 <=1.21.1 +mod.mc_title=1.21 +mod.mc_targets=1.21 1.21.1 \ No newline at end of file diff --git a/versions/1.21-neoforge/gradle.properties b/versions/1.21-neoforge/gradle.properties new file mode 100644 index 00000000..1cbdf8c3 --- /dev/null +++ b/versions/1.21-neoforge/gradle.properties @@ -0,0 +1,15 @@ +loom.platform=neoforge + +# Global +deps.yarn_build=9 +deps.compat= + +# Forge +deps.fapi=0.101.2+2.0.10+1.21 +deps.fml=21.0.167 +deps.yacl=3.5.0+1.21 + +# Mod +mod.mc_dep=[1.21, 1.21.1] +mod.mc_title=1.21 +mod.mc_targets=1.21 1.21.1 \ No newline at end of file