Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SubscribeEvent
- public void onUse(PlayerInteractEvent.RightClickItem event) {
- PlayerEntity player = event.getPlayer();
- Item item = event.getItemStack().getItem();
- CompoundNBT nbt = item.getDefaultInstance().getOrCreateTag();
- if (item == Items.WRITTEN_BOOK) {
- IHealthCapability health = player.getCapability(HealthCapability.HEALTH_CAPABILITY).orElse(null);
- ListNBT pages = new ListNBT();
- if (health.getMaxHealth() >= 2.0F && health.getMaxHealth() <= 6.0F) {
- pages.add(HealthBookUtils.setPageOne(player));
- } else if (health.getMaxHealth() >= 8.0F && health.getMaxHealth() <= 12.0F) {
- pages.add(2, HealthBookUtils.setPageTwo(player));
- }
- }
- }
Add Comment
Please, Sign In to add comment