Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 by SilverfishStone
grammer

	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 );
                }
	            }
        }
    }
	

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.