I can't find any method to create a vanilla goal, so I'm sorry but maybe you should dig into NMS:
Bukkit.getMobGoals().addGoal(mob, 1, new PaperVanillaGoal<>(
new PanicGoal(((CraftMob)mob).getHandle(), 1.5)
));
Yeah you are right, that can absolutely solve my problem, thank you!
My purpose to ask this question here is just think that if there is any official support to do this, since there may always be some unexpected situations that after my plugin restored player's inventory, something bad happened...
Hi! I am making a plugin that generates a custom world, and I want the players to have an indenpendent inventory in this world (which means, when a player enters this world, they will have a new inventory, and will switch back as long as they leave).
The problem is that if I implement this...
You are right! It was renamed to MAX_HEALTH after changing the API version to 1.21.4. But I'm still confused:
1. When I use 1.21.3 server jar, with a 1.21.1 API, this bug didn't occur until I added a bootstrapper. They should be irrelevant
// 2. If the experimental phase ends in the future...
After I used the bootstrapper to create my custom enchantment Glow, an unexpected error occurred.
It shows that GENERIC_MAX_HEALTH is not one of the member field in org.bukkit.attribute.Attribute. This seems to be an mapping error, I guess.
If I change it to the deprecated method...
When you use itemStack.getItemMeta(), you will get a COPY of the ItemMeta. So if you want your modification be persistent, use itemStack.editMeta() instead.
Hope it would help.
You use the PDC held by item, which is an ENTITY! Every time you drop an ItemStack, it will spawn a new Item entity.
So why not use the PDC inside ItemMeta?
EDIT: Can be achieved in a more elegant way by using Brigadier command system
Solved by making a dummy sender:
public class CmdHelper {
public static CommandSender asOpSender(Player player) {
return new AsOpSender(player);
}
public static List<Entity>...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.