diff --git a/build.gradle.kts b/build.gradle.kts index 7c30cf8..a2d6a09 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,11 +6,11 @@ allprojects { group = "io.gitlab.jfronny" } base.archivesName = "yescheat" jfMod { - minecraftVersion = "1.21" - yarn("build.1") - loaderVersion = "0.15.11" - libJfVersion = "3.16.0" - fabricApiVersion = "0.100.1+1.21" + minecraftVersion = "1.21.3" + yarn("build.2") + loaderVersion = "0.16.7" + libJfVersion = "3.18.0" + fabricApiVersion = "0.106.1+1.21.3" modrinth { projectId = "yescheat" @@ -25,7 +25,7 @@ dependencies { // Dev env modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny") modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil") - modLocalRuntime("com.terraformersmc:modmenu:11.0.0-beta.1") + modLocalRuntime("com.terraformersmc:modmenu:12.0.0-beta.1") // for modmenu modLocalRuntime("net.fabricmc.fabric-api:fabric-resource-loader-v0") modLocalRuntime("net.fabricmc.fabric-api:fabric-screen-api-v1") diff --git a/settings.gradle.kts b/settings.gradle.kts index 4347c16..27aa0c1 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,7 +1,6 @@ pluginManagement { repositories { - maven("https://maven.fabricmc.net/") // FabricMC - maven("https://maven.frohnmeyer-wds.de/artifacts") // scripts + maven("https://maven.frohnmeyer-wds.de/mirrors") gradlePluginPortal() } } diff --git a/src/main/java/io/gitlab/jfronny/yescheat/YesCheat.java b/src/main/java/io/gitlab/jfronny/yescheat/YesCheat.java index 848d4cd..bca03e4 100644 --- a/src/main/java/io/gitlab/jfronny/yescheat/YesCheat.java +++ b/src/main/java/io/gitlab/jfronny/yescheat/YesCheat.java @@ -25,10 +25,9 @@ public class YesCheat implements ModInitializer { public static synchronized void villagersFollowEmeraldsInit() { if (!Cfg.villagersFollowEmeralds) throw new IllegalStateException("villagersFollowEmeralds is not enabled but its initializer is called"); if (VILLAGER_TEMPTATIONS == null) { + var tagKey = TagKey.of(RegistryKeys.ITEM, TEMPTATIONS_ID); VILLAGER_TEMPTATIONS = - new SensorType<>(() -> new TemptationsSensor((Ingredient.fromTag( - TagKey.of(RegistryKeys.ITEM, TEMPTATIONS_ID) - )))); + new SensorType<>(() -> new TemptationsSensor(stack -> stack.isIn(tagKey))); } } } diff --git a/src/main/java/io/gitlab/jfronny/yescheat/mixin/VillagersFollowEmeralds1.java b/src/main/java/io/gitlab/jfronny/yescheat/mixin/VillagersFollowEmeralds1.java index 3eda451..2e33662 100644 --- a/src/main/java/io/gitlab/jfronny/yescheat/mixin/VillagersFollowEmeralds1.java +++ b/src/main/java/io/gitlab/jfronny/yescheat/mixin/VillagersFollowEmeralds1.java @@ -5,11 +5,14 @@ import io.gitlab.jfronny.yescheat.YesCheat; import net.minecraft.entity.ai.brain.MemoryModuleType; import net.minecraft.entity.ai.brain.sensor.Sensor; import net.minecraft.entity.ai.brain.sensor.SensorType; +import net.minecraft.entity.attribute.DefaultAttributeContainer; +import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.passive.VillagerEntity; import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.util.ArrayList; @@ -33,4 +36,9 @@ public abstract class VillagersFollowEmeralds1 { newSensors.add(YesCheat.VILLAGER_TEMPTATIONS); SENSORS = ImmutableList.copyOf(newSensors); } + + @Inject(method = "createVillagerAttributes()Lnet/minecraft/entity/attribute/DefaultAttributeContainer$Builder;", at = @At("RETURN"), cancellable = true) + private static void addTemptationAttributes(CallbackInfoReturnable cir) { + cir.setReturnValue(cir.getReturnValue().add(EntityAttributes.TEMPT_RANGE, 10)); + } } diff --git a/src/main/java/io/gitlab/jfronny/yescheat/mixin/VillagersFollowEmeralds2.java b/src/main/java/io/gitlab/jfronny/yescheat/mixin/VillagersFollowEmeralds2.java index 1c9f0cb..91bf267 100644 --- a/src/main/java/io/gitlab/jfronny/yescheat/mixin/VillagersFollowEmeralds2.java +++ b/src/main/java/io/gitlab/jfronny/yescheat/mixin/VillagersFollowEmeralds2.java @@ -14,7 +14,7 @@ public abstract class VillagersFollowEmeralds2 { Object[] modified = new Object[original.length + 2]; System.arraycopy(original, 0, modified, 0, original.length); modified[original.length] = Pair.of(0, new TemptTask(e -> 0.5f)); - modified[original.length + 1] = Pair.of(0, new TemptationCooldownTask(MemoryModuleType.TEMPTATION_COOLDOWN_TICKS)); + modified[original.length + 1] = Pair.of(0, new TickCooldownTask(MemoryModuleType.TEMPTATION_COOLDOWN_TICKS)); return modified; } }