How to world button display condition

Started by Block_BoyZ on

Topic category: Help with MCreator software

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to world button display condition

I'm trying to make it so when you have let's say 3 iron ingots, a button will appear on a GUI that will let you do something. How do I set this condition? Thanks

Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
public class…
Thu, 03/17/2022 - 05:32
public class GetInventoryProcedure {
    public static boolean execute(LevelAccessor world, Entity entity, ItemStack itemstack) {
        if (entity == null)
            return false;
        ItemStack itemtosearchfor = ItemStack.EMPTY;
        double itemcount = 0;
        double minimumcheck = 0;
        itemcount = 0;
        minimumcheck = 3;
        itemtosearchfor = new ItemStack(Items.IRON_INGOT);
        {
            AtomicReference<IItemHandler> _iitemhandlerref = new AtomicReference<>();
            entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> _iitemhandlerref.set(capability));
            if (_iitemhandlerref.get() != null) {
                for (int _idx = 0; _idx < _iitemhandlerref.get().getSlots(); _idx++) {
                    ItemStack itemstackiterator = _iitemhandlerref.get().getStackInSlot(_idx).copy();
                    if (itemstack.getItem() == (itemtosearchfor).getItem()) {
                        itemcount = itemcount + (itemstack).getCount();
                    }
                }
            }
        }
        if (minimumcheck <= itemcount) {
            CccMod.LOGGER.info("Correct ammount at least");
            return true;
        } else {
            CccMod.LOGGER.info("Missing an ammount");
            return false;
        }
    }
}
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it is the code you requested
Thu, 03/17/2022 - 05:35

it is the code you requested