Custom Crafting Table

  • 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!

Goose

Supporter
Nov 23, 2019
439
33
28
Category:
GUI
Suggested name:
CustomCrafting
Spigot/Skript Version:
1.14
What I want:
I would like a custom crafting table gui, I understand this would be really hard cause you have to make the GUI and add in every single vanilla recipe (unless there is an easy way to do that :emoji_stuck_out_tongue:), and if you want to be just the best ever, could you tell me a bit of code I could copy & paste (or something similar) for custom recipes.

Ideas for commands:
No commands.
Ideas for permissions:
Don't need any permissions
When I'd like it by: Any time, no need to rush.
 
Your very right, I should've just asked for a GUI without the recipes. I could probably figure out how to add the recipes myself. >->
There are many plugins that you can make custom crafting recipes though they are not in skript.
 
you could use existing minecraft recipe folder with all the json files and grab recipes from that
 
Proof of concept if you want to try to do it in skript. I wanted to see if it were possible, I would recommend not using this though. Also, may have misread the request.

"Features:"

Uses SkRayFall (Maybe), and Skellet
Only shaped crafting
No multiple of items allowed in crafting (Easily changed)
Probably laggy
Uses a lot of variables
Getting non registered recipes gives the player the item instead of allowing the player to pick the item up.
Getting items will temporarily display 2x the number before removing the crafting supplies.

Have fun!

code_language.skript:
function setupRecipe():
  loop {CTB::r::*}:
    delete {CTB::r::%loop-index%::*}

  set {CTB::r::snowball} to 16 snowballs
  set {CTB::r::snowball::*} to air, air, air, air, air, air, dirt, air, and air

function checkRecipe(inv: inventory, player: player):

  {CTB::p::%{_player}%::Cost} is set:
    delete {CTB::p::%{_player}%::Cost}
  loop 9 times:
    add 1 of slot loop-number of {_inv} to {_temp::*}
  loop {CTB::r::*}:
    if "%{CTB::r::%loop-index%::*}%" is "%{_temp::*}%":
      set {CTB::p::%{_player}%::Cost} to loop-index
      set slot 0 of {_inv} to loop-value
  update inventory {_inv}

function removeRecipeItems(inv: inventory, player: player):
  remove {CTB::r::%{CTB::p::%{_player}%::Cost}%::*} from {_inv}
  give {_player} {CTB::r::%{CTB::p::%{_player}%::Cost}%}
  delete {CTB::p::%{_player}%::Cost}

on inventory click:
  {CTB::p::%player%} is set
  event-inventory is set
  if inventory type of event-inventory is "WORKBENCH":
    if event-slot is 0:
      {CTB::p::%player%::Cost} is set
      cancel event
      removeRecipeItems(event-inventory, player)

    wait 1 tick
    checkRecipe(event-inventory, player)

on join:
  delete {CTB::p::%player%::Cost}
  delete {CTB::p::%player%}
on inventory close:
  delete {CTB::p::%player%::Cost}
  delete {CTB::p::%player%}


command /ctb:
  trigger:
    setupRecipe()
    open crafting table inventory to player
    set {CTB::p::%player%} to player