-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
43 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...io/github/rektroth/whiteout/mixin/entity/ai/brain/task/VillagerTaskListProviderMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Patch for MC-157464 | ||
* | ||
* Authored for CraftBukkit/Spigot by Jake Potrebic <[email protected]> on July 11, 2022. | ||
* Ported to Fabric by Rektroth <[email protected]> on April 25, 2024. | ||
*/ | ||
|
||
package io.github.rektroth.whiteout.mixin.entity.ai.brain.task; | ||
|
||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.ai.brain.task.Task; | ||
import net.minecraft.entity.ai.brain.task.VillagerTaskListProvider; | ||
import net.minecraft.entity.ai.brain.task.WalkToNearestVisibleWantedItemTask; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(VillagerTaskListProvider.class) | ||
public class VillagerTaskListProviderMixin { | ||
@Redirect( | ||
at = @At( | ||
target = "Lnet/minecraft/entity/ai/brain/task/WalkToNearestVisibleWantedItemTask;create(FZI)Lnet/minecraft/entity/ai/brain/task/Task;", | ||
value = "INVOKE"), | ||
method = "createCoreTasks") | ||
private static Task<LivingEntity> goToWantedItemFix(float speed, boolean requiresWalkTarget, int radius) { | ||
return WalkToNearestVisibleWantedItemTask.create( | ||
villager -> !villager.isSleeping(), | ||
speed, | ||
requiresWalkTarget, | ||
radius | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters