Skip to content

Commit

Permalink
fix: Villager conversion chance config option
Browse files Browse the repository at this point in the history
fixes #34
  • Loading branch information
DrexHD committed Jul 9, 2023
1 parent 07a0f9c commit 1863d5a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 41 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 2 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -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
}
}
}
}
}
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
mixin_extras_version=0.2.0-beta.9
config2brigadier_version=1.2.5
7 changes: 4 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions src/main/java/me/drex/villagerconfig/mixin/ZombieMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ protected ZombieMixin(EntityType<? extends Monster> entityType, Level level) {
}

@Inject(
method = "hurt",
method = "killedEntity",
at = @At("HEAD")
)
public void calculateConversionChance(DamageSource damageSource, float f, CallbackInfoReturnable<Boolean> cir) {
public void calculateConversionChance(ServerLevel serverLevel, LivingEntity livingEntity, CallbackInfoReturnable<Boolean> cir) {
double conversionChance = CONFIG.features.conversionChance;
if (conversionChance < 0D) {
difficulty = this.level().getDifficulty();
Expand All @@ -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;
}

Expand Down

0 comments on commit 1863d5a

Please sign in to comment.