GUI where you can only place certain items or tags

Started by RexCerv on

Topic category: Help with modding (Java Edition)

Last seen on 04:28, 26. Jan 2024
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
GUI where you can only place certain items or tags

PLEASE ONLY ANSWER IF YOU KNOW THE ANSWER BECAUSE IT IS MORE LIKELY THAT YOU WILL SEE THIS IF THERE ARE NO USELESS ANSWERS

So I wanted to make a GUI and for testing, I made only 1 slot, in this slot I wanted to know if it's possible to specify only to accept certain items, so I first added a random block in the specification and then going to the code and deleting it, then I tried adding the stuff I want to specify where the random block was (and yes I did Import all of the items and delete completely the other block). And because it didn't work, I was wondering if there's a way to do it with procedures or just coding, maybe I did it wrong. By the way, I'm in 2021.1, Minecraft Version 1.16. 

(If anyone didn't understand what I meant, here's an example: Imagine I want to only be able to put Gold, Diamond, Iron, Coal, etc on 1 slot, but I can't put other items like dirt or other things. And yes MCreator does let me specify items per slot, but it only lets me specify 1 item, when I want to specify at least 10.)

Last seen on 19:23, 15. Sep 2021
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
man please help
Sun, 09/12/2021 - 03:02

man please help

Last seen on 04:28, 26. Jan 2024
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hm?
Sun, 09/26/2021 - 21:10

hm?

Last seen on 01:58, 23. Nov 2021
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Show me your procedure.  
Mon, 09/27/2021 - 13:57

Show me your procedure.

 

Last seen on 04:28, 26. Jan 2024
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
that's the point, I don't…
Mon, 09/27/2021 - 16:37

that's the point, I don't have one, I don't even know where to start.

Last seen on 01:58, 23. Nov 2021
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Off the top ofy head I can't…
Mon, 09/27/2021 - 20:54

Off the top ofy head I can't think of a way to block items but you can make only do things if certain things are in the slot. For example

If slot 0 = diamond do blank

Then another if statement

If slot 0 = gold do blank and so on

If you do blank is pretty much the same like if diamond make weapon more op and with gold still on but less then diamond. Then make your 1st if statement the copy it and change what you need 

If they add dirt nothing  will happen

Last seen on 01:58, 23. Nov 2021
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry. Typed that on my…
Mon, 09/27/2021 - 20:56

Sorry. Typed that on my phone and fat fingered the hell out of it

Last seen on 04:28, 26. Jan 2024
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
first of all, it is not a…
Mon, 09/27/2021 - 21:04

first of all, it is not a block but an item, and it works like a chest not a crafting table

Last seen on 04:28, 26. Jan 2024
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I want to make a storage…
Mon, 09/27/2021 - 21:04

I want to make a storage where you can only place for example, Tag Log

Last seen on 04:28, 26. Jan 2024
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
(just an example)
Mon, 09/27/2021 - 21:05

(just an example)

Last seen on 04:28, 26. Jan 2024
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think I didn't explain…
Mon, 09/27/2021 - 21:06

I think I didn't explain myself correctly, so imagine I have an item named Portable Ore Chest and I want it to only be able to put Diamond/Iron/Gold/Redstone/Lapiz, how would I do that 

Last seen on 15:08, 8. May 2022
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Off the top of my head maybe…
Fri, 10/22/2021 - 21:43

Off the top of my head maybe if the item in the slot is not diamond or whatever then return it to your inventory

Last seen on 04:28, 26. Jan 2024
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
that would work, but that…
Fri, 10/22/2021 - 22:02

that would work, but that would look kinda Nooby, if I find a way to put tags through code, that would look 10x better

Last seen on 01:21, 7. Jan 2022
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Trying to figure it as well,…
Tue, 01/04/2022 - 01:57

Trying to figure it as well, i really don't know anything about java but when you limit the slot to a certain item, the code add : 
 

        this.customSlots.put(54, this.addSlot(new SlotItemHandler(internal, 54, 175, 15) {
            @Override
            public boolean mayPlace(ItemStack stack) {
                return (Blocks.COAL_ORE.asItem() == stack.getItem());
            }

So maybe we can copy that line and only allow certain item this way ? I gotta go to work i'll try once i get home

Last seen on 01:21, 7. Jan 2022
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
1 - Open your GUI 2- Add a…
Tue, 01/04/2022 - 02:01

1 - Open your GUI

2- Add a slot with a limited item ex : Coal_ore

3- Save mod element

4- Go to your workspace, rightclick your GUI --> Open mod element in code editor

5- Should be the first option (TheNameOfYourGUIMenu.java)

With that, If someone is online while i'm not, might be able to figure it out. Thanks ! Hope this will help me as well xD