Posted June 4, 20241 yr I want to make an item could be a curios item if Curios is present but is worn in an armor slot if not. Is there a way to add optional Curios functionality to a custom item without requiring Curios? For example, the item would allow the wearer to breathe underwater if worn in chest Curios slot, or as a chestplate if curios is not present. Edited June 4, 20241 yr by SilverfishStone grammer
June 9, 20241 yr use inventorytick() whit the slot number you can know if its into an armour slot //########## ########## ########## public void inventoryTick(ItemStack helditem, Level warudo, Entity en, int slot, boolean value) { Long wtick = 0L; int tick = 0; // System.out.println("\n#inventoryTick#\n"); if( !warudo.isClientSide ){ wtick = warudo.dayTime(); if( wtick % 20 == 0 && en instanceof Player ) { item_handler ih = get_itemhandler(helditem); //inicializar tiempo if (ih.start_time < 1L) { ih.start_time = wtick; } ih.time = (int) ( wtick - ih.start_time ); tick = ih.time; //cada 5 seg causar daño por fuego al player if (tick > 0 && tick % 100 == 0) { en.setSecondsOnFire(1); } //despues de un minuto el lingote se enfria y vielve a ser hierro if ( tick > 1200 ) { // helditem = new ItemStack( Items.IRON_INGOT, helditem.getCount() ); ((Player) en).getInventory().setItem(slot, helditem ); } } } }
June 10, 20241 yr Author 2 hours ago, perromercenary00 said: use inventorytick() whit the slot number you can know if its into an armour slot //########## ########## ########## public void inventoryTick(ItemStack helditem, Level warudo, Entity en, int slot, boolean value) { Long wtick = 0L; int tick = 0; // System.out.println("\n#inventoryTick#\n"); if( !warudo.isClientSide ){ wtick = warudo.dayTime(); if( wtick % 20 == 0 && en instanceof Player ) { item_handler ih = get_itemhandler(helditem); //inicializar tiempo if (ih.start_time < 1L) { ih.start_time = wtick; } ih.time = (int) ( wtick - ih.start_time ); tick = ih.time; //cada 5 seg causar daño por fuego al player if (tick > 0 && tick % 100 == 0) { en.setSecondsOnFire(1); } //despues de un minuto el lingote se enfria y vielve a ser hierro if ( tick > 1200 ) { // helditem = new ItemStack( Items.IRON_INGOT, helditem.getCount() ); ((Player) en).getInventory().setItem(slot, helditem ); } } } } I understand how to make the item function in the inventory, but I want to add an optional Curios functionality. Is there a way to add functionality without requiring Curios as a dependency?
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.