Hi all,
I'm new to modding (although not to java) and I'm trying to make a player who holds a certain item be able to fly in survival mode. I've done my best to look this issue up, but everything I'm finding, even on this forum, seems to be outdated, except for the way I've done it, which doesn't seem to be working. The player is not able to fly even when holding the item. I even took a look at the source for the curseforge Angel Ring mod and It seems to use the same method to enable flight.
Here's the event listener I'm using:
@SubscribeEvent
public static void honorbladePowers(TickEvent.PlayerTickEvent e) {
if (e.player.getItemInHand(InteractionHand.MAIN_HAND).getItem() instanceof ShardbladeItem) {
e.player.getAbilities().mayfly = true;
e.player.onUpdateAbilities();
} else {
e.player.getAbilities().mayfly = false;
e.player.onUpdateAbilities();
}
}
Any help as to why enabling mayfly and then calling onUpdateAbilities() isn't working would be awesome! Thanks y'all!