Sample code that allows you to prohibit putting several things in your Gui

Started by Mr_Zugibol on

Topic category: Help with modding (Java Edition)

Last seen on 19:50, 15. Nov 2020
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sample code that allows you to prohibit putting several things in your Gui
Fri, 06/12/2020 - 11:39 (edited)

import net.minecraft.block.Blocks;

 

this.customSlots.put(0, this.addSlot(new SlotItemHandler(internal, 0, 34, 30) {
                @Override
                public boolean isItemValid(ItemStack stack) {
                    boolean blockCriteria = true;
                    if (new ItemStack(Blocks.SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.WHITE_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.ORANGE_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.MAGENTA_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.LIGHT_BLUE_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.YELLOW_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.LIME_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.PINK_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.GRAY_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.LIGHT_GRAY_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.CYAN_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.PURPLE_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.BLUE_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.BROWN_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.GREEN_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.RED_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    if (new ItemStack(Blocks.BLACK_SHULKER_BOX, (int) (1)).getItem() == stack.getItem()){
                    blockCriteria = false;}
                    
                return blockCriteria;

                }

Edited by Mr_Zugibol on Fri, 06/12/2020 - 11:39