From 1863d5af41d20d4cb8aaf432a25d2f73f6465029 Mon Sep 17 00:00:00 2001 From: Drex Date: Sun, 9 Jul 2023 13:50:36 +0200 Subject: [PATCH] fix: Villager conversion chance config option fixes #34 --- CHANGELOG.md | 4 +++ build.gradle | 28 ++----------------- gradle.properties | 14 +++++----- gradle/wrapper/gradle-wrapper.properties | 7 +++-- .../villagerconfig/mixin/ZombieMixin.java | 10 +++---- 5 files changed, 22 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8749a4..d382b78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.0.2] - 2023-07-09 +### Fixed +- Villager conversion chance config option not working + ## [4.0.1] - 2023-03-01 ### Fixed - Immediate crash on startup diff --git a/build.gradle b/build.gradle index 60e48cb..c838264 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' + id 'fabric-loom' version '1.3-SNAPSHOT' id 'maven-publish' } @@ -68,32 +68,8 @@ tasks.withType(JavaCompile).configureEach { it.options.release.set(17) } - -// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task -// if it is present. -// If you remove this task, sources will not be generated. -task sourcesJar(type: Jar, dependsOn: classes) { - classifier("sources") - from sourceSets.main.allSource -} - jar { from("LICENSE") { rename { "${it}_${project.archivesBaseName}" } } -} - -// configure the maven publication -publishing { - publications { - mavenJava(MavenPublication) { - // add all the jars that should be included when publishing to maven - artifact(remapJar) { - builtBy remapJar - } - artifact(sourcesJar) { - builtBy remapSourcesJar - } - } - } -} +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 22d00da..5bd7ca1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,16 +1,16 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G # Fabric Properties -minecraft_version=1.20-rc1 +minecraft_version=1.20.1 loader_version=0.14.21 # Mod Properties -mod_version=4.0.1 +mod_version=4.0.2 maven_group=me.drex archives_base_name=villagerconfig # Dependencies -fabric_version=0.83.0+1.20 -mod_menu_version=7.0.0-beta.2 -cloth_config_version=11.0.98 +fabric_version=0.85.0+1.20.1 +mod_menu_version=7.1.0 +cloth_config_version=11.0.99 fiber_version=0.23.0-2 -mixin_extras_version=0.2.0-beta.8 -config2brigadier_version=1.2.3 \ No newline at end of file +mixin_extras_version=0.2.0-beta.9 +config2brigadier_version=1.2.5 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8da97bb..62f495d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Thu Aug 06 23:53:32 CEST 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/src/main/java/me/drex/villagerconfig/mixin/ZombieMixin.java b/src/main/java/me/drex/villagerconfig/mixin/ZombieMixin.java index 581bb3e..38524cf 100644 --- a/src/main/java/me/drex/villagerconfig/mixin/ZombieMixin.java +++ b/src/main/java/me/drex/villagerconfig/mixin/ZombieMixin.java @@ -27,10 +27,10 @@ protected ZombieMixin(EntityType entityType, Level level) { } @Inject( - method = "hurt", + method = "killedEntity", at = @At("HEAD") ) - public void calculateConversionChance(DamageSource damageSource, float f, CallbackInfoReturnable cir) { + public void calculateConversionChance(ServerLevel serverLevel, LivingEntity livingEntity, CallbackInfoReturnable cir) { double conversionChance = CONFIG.features.conversionChance; if (conversionChance < 0D) { difficulty = this.level().getDifficulty(); @@ -44,14 +44,14 @@ public void calculateConversionChance(DamageSource damageSource, float f, Callba } @Redirect( - method = "hurt", + method = "killedEntity", at = @At( value = "INVOKE", - target = "Lnet/minecraft/world/level/Level;getDifficulty()Lnet/minecraft/world/Difficulty;" + target = "Lnet/minecraft/server/level/ServerLevel;getDifficulty()Lnet/minecraft/world/Difficulty;" ), require = 0 ) - public Difficulty shouldConvert(Level level) { + public Difficulty shouldConvert(ServerLevel serverLevel) { return difficulty; }