From 282bdcd887968ba71399113cc5f10b1785e623a5 Mon Sep 17 00:00:00 2001 From: Neovitalism Date: Wed, 21 Feb 2024 19:06:01 -0600 Subject: [PATCH] Fix GoalSelector crash Fixes crash caused by removing all goals - https://pastebin.com/YkKb9xhd Removing goals is redundant as Minecraft handles goals not being run while the entity has a passenger (Example: `WanderAroundGoal#canStart()`) I also changed it so the player must have an empty hand, as pokemon can hold more than just cobblemon items. I also bumped version and changed the gradle from 48GB to 2GB because that absolutely demolished my 16GB RAM PC and is not needed lmao --- gradle.properties | 4 ++-- src/main/java/net/ioixd/Cobblemounts.java | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index f73032d..da58ddd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx48G +org.gradle.jvmargs=-Xmx2G org.gradle.parallel=true # Fabric Properties @@ -9,7 +9,7 @@ yarn_mappings=1.20.1+build.1 loader_version=0.14.22 # Mod Properties -mod_version=1.2.1 +mod_version=1.2.2 maven_group=net.ioixd archives_base_name=cobblemounts diff --git a/src/main/java/net/ioixd/Cobblemounts.java b/src/main/java/net/ioixd/Cobblemounts.java index 3031f57..39b2779 100644 --- a/src/main/java/net/ioixd/Cobblemounts.java +++ b/src/main/java/net/ioixd/Cobblemounts.java @@ -6,7 +6,8 @@ import net.fabricmc.fabric.api.event.player.UseEntityCallback; import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; -import net.minecraft.item.Item; +import net.minecraft.entity.ai.goal.EatGrassGoal; +import net.minecraft.entity.ai.goal.WanderAroundGoal; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; @@ -65,12 +66,9 @@ public void onInitialize() { } } - Item item = player.getMainHandStack().getItem(); - if (!item.getTranslationKey().contains("item.cobblemon")) { + if (player.getMainHandStack().isEmpty()) { player.startRiding(entity, false); - pkmnEntity.clearGoalsAndTasks(); } - } } }