Started by
Block_BoyZ
on
Topic category: Help with MCreator software
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
Topic category: Help with MCreator software
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
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; } } }it is the code you requested