Posted June 3, 20232 yr @SubscribeEvent public static void onAttachToEntity(AttachCapabilitiesEvent<Entity> event){ if(event.getObject() instanceof Player player){ event.addCapability(Helper.createRL("player_data"), new PlayerData(player)); } } public PlayerData(Player player) { this.player = player; this.setCurrentEnergy(this.getMaxEnergy()); } public int getMaxEnergy() { return (int) this.player.getAttributeValue(AttributeInit.MAX_ENERGY.get()); } and console log https://gist.github.com/MatyBotStorage/138473d7c4c7a43ad4b453baa4fda529
June 5, 20232 yr Why do you need a capability if you are using an attribute instead? You should not need to intermingle the two systems like this.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.