Skip to content

Commit

Permalink
Initial 1.21 support (#192)
Browse files Browse the repository at this point in the history
* Migrate to polymer

* npc selections glow again

* skin layers working again

* set skin layers to all on by default

* Fix #137 (rewrite/polymer) (#181)

* fix #137 (init): speak distance, requires some testing

* fix: removed refmap field in common.mixins.json, fixed crash
- Replacement was not anywhere in build setup
- Loom automatically adds the right refmap anyway, no need to explicitly define it

* removed commented code (lol)

* Update gradle.properties to iterate mod_version

Updated mod_version to ensure compatibility with FabricTailor is retained

* Update Taterzens.java to init lang as the correct datatype

Initialised an empty JsonObject to ensure the mod doesn't trip over lang being null.  Has the odd side effect of allowing the GUI to start working.

* Update LanguageUtil.java Language file path

Updated the path to the language files within the .jar.  Note that it loads from within it, NOT from the filepath in the config folder.

* Update TextUtil.java Commenting out SERVER_TRANSLATION

Commented out SEVER_TRANSLATIONS reference because it was blocking any attempt to read from the language.json files in toto.  This may be removed in future as it doesn't seem to apply anywhere else in the codebase, and was returning nothing that could be used by the functions seeking translation.

* Update EditorGUI.java Generate UUID to prevent GameProfile null crash

Generated temporary UUID to keep GameProfile from crashing the server when it tries to generate a result using a null uuid entry.

* Update Taterzens.java Syntax Error Fix

Fix syntax error for defining JsonObject

* Update TaterzensClient.java

This just seems to be dead code.  It throws an error at build when not commented out, but doesn't seem to affect mod function.  Most of the imports can be removed, too.

* Update TypeCommand.java

Introduced the concept of modEntity, which is a part of an NPC's definition, and which maps directly to the Entity Type in CAPS.

* Update NPCData.java

Added the hashmaps for the entity list and player entity so that we can track and manipulate them with ease when setting TYPE.

* Update TaterzenNPC.java

We make the necessary changes to allow player TYPE to be edited and for it to persist across world / game loads.

* Update TaterzenNPC.java

Loose bracket...

* Update build.gradle

Changes to exclude disguiselib (polymer provides that function), servertranslations (unsure of 1.21 version support, but doesn't impact most mod function), and updated Java build versions and targets inline with the requirements for 1.21

* Update gradle.properties

Updated the Fabric Properties to 1.21 requirements.  Updated the mod_version, and dependencies that support 1.21

* Update TextUtil.java

toJson and fromJson now need a provider as the final argument when invoked.  Currently nulled, and seems to work fine.  May require more investigation later.

* Update FabricPlatform.java

Commented out the openEditorGui code (and import) since we've disabled the GUI for now as part of the 1.21 update.

The issues is tied to ItemStacks and whether we'll stick to the official mappings or Yarn going forward.

* Update Taterzens.java

Changes to ResourceLocation introduced in Minecraft 1.21

* Update NpcCommand.java

Commented out the teleport command for now.  TODO work to correct its implementation with Minecraft 1.21 changes.

* Update TaterzensCommand.java

Updated the ResourceLocation code to match Minecraft 1.21 support

* Update TeleportCommand.java

Temporarily disables the teleport command while working out the 1.21 Minecraft changes.

* Update BehaviourCommand.java

Updated to address the ResourceLocation changes in 1.21

* Update MovementCommand.java

Updated to address the ResourceLocation changes for 1.21

* Update TaterzensCommand.java

Error when running prior diff.  Corrected the corrected ResourceLocation fix.

* Update BehaviourCommand.java

Corrected error from prior diff.  Related to the ResourceLocation fix.

* Update ProfessionsCommand.java

Updated the ResourceLocation implementation in accordance with 1.21

* Update SoundCommand.java

Updated ResourceLocation usage in accordance with the 1.21 ResourceLocation implementation.

* Update TypeCommand.java

Commenting out the DisguiseLib support for now, as Polymer provides the entity type modification interface.

* Update CommandsCommand.java

Updated the ResourceLocation code in accordance with the 1.21 ResourceLocation changes.

* Update ServerGamePacketListenerImplMixin_MsgEditor.java

Updated fromJson implementation with changes to Serializer with Minecraft 1.21

* Update TaterzenNPC.java

Significant changes throughout:

- setMaxUpStep is removed from 1.20.5
- ResourceLocation changes to meet 1.21
- dropCustomDeathLoot issues to be resolved
- isLeashed issues to be resolved
- Projectile related issues to be resolved
- Issues with data.removeIf implementation to be resolved
-

* Update BungeeCommand.java

Updated ResourceLocation code to 1.21 implementation.  Commented out ClientBoundCustomPayloadPacket code as it still needs work to meet 1.21.

Query whether Bungee support is still required in the mod.

* Update ScarpetProfession.java

Updated the ResourceLocation code to meet 1.21

* Update FabricPlatform.java

Fixed spelling mistake.  Main update was to temporarily comment out the EditorGUI functions.

* Update MessagesEditGUI.java

Commented out issues with itemStack implementation that haven't been resolved to the 1.21 implementation yet.  As such, the GUIs have been disabled for now.

* Update ListItemsGUI.java

Commented out issues with itemStack implementation that haven't been resolved to the 1.21 implementation yet.  As such, the GUIs have been disabled for now.

* Update EditorGUI.java

Commented out issues with itemStack implementation that haven't been resolved to the 1.21 implementation yet.  As such, the GUIs have been disabled for now.

---------

Co-authored-by: samolego <[email protected]>
Co-authored-by: MagicSweet <[email protected]>
  • Loading branch information
3 people authored Sep 4, 2024
1 parent ad3d221 commit 41b9f92
Show file tree
Hide file tree
Showing 114 changed files with 1,205 additions and 1,558 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/fabric-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: build
run: ./gradlew fabric:build
run: ./gradlew build
- name: capture build artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/fabric-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ jobs:
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew fabric:build --stacktrace
run: ./gradlew :build --stacktrace

- name: Upload GitHub release
uses: AButler/[email protected]
with:
files: "fabric/build/libs/*.jar"
files: 'build/libs/*.jar'
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish with Gradle
run: ./gradlew fabric:modrinth fabric:curseforge --stacktrace
run: ./gradlew modrinth curseforge --stacktrace
env:
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
Expand Down
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ bin/

run/

# Architectury
.architectury-transformer
# java

hs_err_*.log
replay_*.log
*.hprof
*.jfr
289 changes: 158 additions & 131 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,141 +1,168 @@
plugins {
// Fabric loom
id "fabric-loom" version "1.1-SNAPSHOT" apply false
// Forge Gradle
id 'net.minecraftforge.gradle' version '6.0.+' apply false
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'

id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id "com.modrinth.minotaur" version "2.+" apply false
id 'com.matthewprenger.cursegradle' version '1.4.0'
id "com.modrinth.minotaur" version "2.+"
}

version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name
}

repositories {
mavenCentral()
maven {
url 'https://jitpack.io'
}
maven { url "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven" }
maven { url 'https://maven.nucleoid.xyz' }
maven {
url 'https://masa.dy.fi/maven'
}
maven { url 'https://jitpack.io' }
}

allprojects {
apply plugin: "java"
apply plugin: "maven-publish"

archivesBaseName = rootProject.archives_base_name + "-" + project.name + "-" + rootProject.minecraft_version
version = rootProject.mod_version
group = rootProject.maven_group

repositories {
mavenCentral()
maven {
url 'https://jitpack.io'
}
maven { url 'https://maven.nucleoid.xyz' }
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"

def javaTarget = 17
it.options.release = javaTarget

sourceCompatibility = JavaVersion.toVersion(javaTarget)
targetCompatibility = JavaVersion.toVersion(javaTarget)

if (JavaVersion.current() < JavaVersion.toVersion(javaTarget)) {
toolchain.languageVersion.set(JavaLanguageVersion.of(javaTarget))
}
}

publishing {
publications {
mavenJava(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
mavenLocal()
}
}
loom {
splitEnvironmentSourceSets()

mods {
"taterzens" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}

}

subprojects {

// Publishing plugins
if (it.name != "common") {
apply plugin: "com.modrinth.minotaur"
apply plugin: "com.matthewprenger.cursegradle"
}

if (it.name != "forge") {
apply plugin: "fabric-loom"
repositories {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
maven {
url 'https://masa.dy.fi/maven'
}
}

loom {
accessWidenerPath = file("${project.rootDir}/common/src/main/resources/taterzens.accesswidener")
}

dependencies {
// To change the versions see the gradle.properties file
modImplementation "net.fabricmc:fabric-loader:${rootProject.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_version}"
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.layered {
//mappings("net.fabricmc:yarn:$project.yarn_mappings:v2")
it.officialMojangMappings()
}

// C2B
modImplementation("com.github.samolego.Config2Brigadier:config2brigadier-fabric:${rootProject.c2b_version}")


// Disguiselib
modImplementation("xyz.nucleoid:disguiselib-fabric:${project.disguiselib_version}")
}
}

if (it.name != "common") {
dependencies {
compileOnly project(":common")
}

processResources {
from project(":common").sourceSets.main.resources
}

tasks.withType(JavaCompile) {
source(project(":common").sourceSets.main.allSource)
}
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
manifest {
attributes([
"Specification-Title" : rootProject.archives_base_name,
"Specification-Vendor" : "",
"Specification-Version" : rootProject.mod_version,
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : "",
"MixinConfigs" : "${rootProject.archives_base_name}.mixins.json",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.layered {
//mappings("net.fabricmc:yarn:$project.yarn_mappings:v2")
it.officialMojangMappings()
}
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Mod Dependencies

// Carpet Mod
modCompileOnly("com.github.gnembon:fabric-carpet:${project.carpet_core_version}")

// Disguiselib
// Commented out of main codebase for now, as TYPE change is achieved by Poylmer
//modCompileOnly("xyz.nucleoid:disguiselib-fabric:${project.disguiselib_version}")
//modImplementation(include('com.github.NucleoidMC:DisguiseLib:90bf223196'))

// Permission API
modImplementation(include('me.lucko:fabric-permissions-api:0.1-SNAPSHOT'))

// Server translations
// Commented out for now until we can confirm the 1.21 supported version. Does not impact general mod function
//modImplementation(include("xyz.nucleoid:server-translations-api:${project.translations_api}"))

// SGUI
modImplementation(include("eu.pb4:sgui:${project.sgui_version}"))

// C2B
modImplementation(include("com.github.samolego.Config2Brigadier:config2brigadier-fabric:${project.c2b_version}"))

// Polymer
modImplementation(include("eu.pb4:polymer-core:${project.polymer_version}"))

}

processResources {
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}
}

tasks.withType(JavaCompile).configureEach {
// One of the big changes to 1.21 is a requirement for at least Java 21, using 22 as it's current at time of dev.
it.options.release = 22
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_22
targetCompatibility = JavaVersion.VERSION_22
}

jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}" }
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}

def ENV = System.getenv()

// from FAPI https://github.com/FabricMC/fabric/blob/1.16/build.gradle
curseforge {
if (ENV.CURSEFORGE_API_KEY) {
apiKey = ENV.CURSEFORGE_API_KEY
}

project {
id = "446499"
changelog = ENV.CHANGELOG ?: "A changelog can be found at https://github.com/samolego/Taterzens/releases/tag/${version}"
releaseType = "release"
addGameVersion "${project.minecraft_version}"
addGameVersion "Fabric"
addGameVersion "Quilt"

mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}-fabric.jar")) {
displayName = "[${project.minecraft_version}] Taterzens ${version}"
}

afterEvaluate {
uploadTask.dependsOn("remapJar")
}
}

options {
forgeGradleIntegration = false
}
}

modrinth {
token = ENV.MODRINTH_TOKEN
projectId = "vE972Kux"
versionNumber = project.minecraft_version + "+" + version + "-fabric"
versionType = "release"
changelog = ENV.CHANGELOG ?: "A changelog can be found at https://github.com/samolego/Taterzens/releases/tag/${version}"
versionName = "[${project.minecraft_version}] Taterzens ${version} [Fabric]"

uploadFile = file("${project.buildDir}/libs/${archivesBaseName}-${version}-fabric.jar")

gameVersions = ["${project.minecraft_version}"]
loaders = ['fabric', 'quilt']

dependencies { // A special DSL for creating dependencies
required.project "fabric-api" // Creates a new required dependency on Fabric API
}
}
Empty file removed common/build.gradle
Empty file.
Loading

0 comments on commit 41b9f92

Please sign in to comment.