1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Checking items in brewing stand

Discussion in 'Skript' started by Very Cool Bee, May 27, 2020.

Thread Status:
Not open for further replies.
  1. Very Cool Bee

    Very Cool Bee New Member

    Joined:
    May 21, 2020
    Messages:
    7
    Likes Received:
    1
    Hello! How can I check the item player puts into a brewing stand?
    I want to prevent people from putting fermented spider eye into a brewing stand.
    Thanks :wrong:
     
  2. WeeHee

    WeeHee Active Member

    Joined:
    Mar 4, 2017
    Messages:
    108
    Likes Received:
    21
    Solution:
    Code (Text):
    1. on inventory click:
    2.     if event-itemtype is fermented spider eye:
    3.         if inventory type is brewing stand inventory:
    4.             cancel event
     
  3. rustedst

    rustedst Active Member

    Joined:
    Apr 24, 2020
    Messages:
    97
    Likes Received:
    4
    That's the correct solution, but players can put the eye using number keys. So use this:
    Code (Text):
    1. on inventory click:
    2.     if type of event-item is fermented spider eye:
    3.         if inventory type is brewing stand inventory:
    4.             cancel event
    5.     if type of event-item is air:
    6.         if inventory type is brewing stand inventory:
    7.             if click type is number key:
    8.                 cancel event
     
    • Agree Agree x 1
  4. WeeHee

    WeeHee Active Member

    Joined:
    Mar 4, 2017
    Messages:
    108
    Likes Received:
    21
    That's true

    Maybe this would be better. Less code but does the same.
    Code (Text):
    1. on inventory click:
    2.     if inventory type is brewing stand inventory:
    3.         if event-itemtype is fermented spider eye:
    4.             cancel event
    5.         else if click type is number key:
    6.             cancel event
     
  5. Very Cool Bee

    Very Cool Bee New Member

    Joined:
    May 21, 2020
    Messages:
    7
    Likes Received:
    1
    Well these codes work, but:
    It prevents any movement of the fermented spider eye in my inventory. If I open the brewing stand I can't move this item at all. I just wanted to prevent players from putting it to the brewing stand.
    Also I found a bug - when I opened my normal inventory and wanted to just move the spider eye to the other slot it started copying itself. It's really weird...
     
  6. WeeHee

    WeeHee Active Member

    Joined:
    Mar 4, 2017
    Messages:
    108
    Likes Received:
    21
    I don't know how I could make them able to move the spider eye when inside of the brewing stand without allowing them to use it.

    The other bug is fixed:
    Code (Text):
    1. on inventory click:
    2.     if type of current inventory of player is brewing stand inventory:
    3.         if event-itemtype is fermented spider eye:
    4.             cancel event
    5.         else if click type is number key:
    6.             cancel event
     
  7. rustedst

    rustedst Active Member

    Joined:
    Apr 24, 2020
    Messages:
    97
    Likes Received:
    4
    Code (Text):
    1. on inventory click:
    2.     if type of current inventory of player is brewing stand inventory:
    3.         if event-slot is slot 0 or 1 or 2 or 3 or 4 of event-iventory:
    4.             if event-itemtype is fermented spider eye:
    5.                 cancel event
    6.             else if click type is number key:
    7.                 cancel event
     
  8. WeeHee

    WeeHee Active Member

    Joined:
    Mar 4, 2017
    Messages:
    108
    Likes Received:
    21
    How would that fix it? Wouldn't it just prevent the player from moving the spider eye out of a brewing stand?
     
  9. Runakai

    Moderator Supporter

    Joined:
    Apr 27, 2018
    Messages:
    497
    Likes Received:
    31
    Just use the code that worked but also in your inventory and add this:

    event-inventory != Player's inventory
     
  10. WeeHee

    WeeHee Active Member

    Joined:
    Mar 4, 2017
    Messages:
    108
    Likes Received:
    21
    If you mean like this, it wouldn't work:
    Code (Text):
    1. on inventory click:
    2.     if event-inventory != Player's inventory:
    3.         if type of current inventory of player is brewing stand inventory:
    4.             if event-itemtype is fermented spider eye:
    5.                 cancel event
    6.             else if click type is number key:
    7.                 cancel event
     
Thread Status:
Not open for further replies.

Share This Page

Loading...