Aller au contenu

Recherche par Anvil


Messages recommandés

Posté(e)

Version de minecraft / skript : 1.11.2

Type du skript : Système de recherche

 

 

Bonsoir, ça fait déjà plusieurs mois que je cherche ça mais que je ne trouve pas sur internet, et que j'arrive pas a faire aussi.

J'aimerais faire un système de recherche dans une interface d'enclume comme ci-dessous

693ae55e3632079cbf61e3bcf50f01cc.gif

( pas mon gif )

 

Je cherche pas un système complet mais juste la partie avec l'enclume

Voilà si quelqu'un a déja fait ça et qu'il pourrais m'aider ce serait cool :D

Posté(e)

Merci mais je recherche uniquement avec l'enclume (j'ai déjà un code pour le panneau)

apparemment Rush a réussi a le faire, il va me passer un code dans la semaine, mais si quelqu'un l'a déjà fait n'hésitez pas :D

Posté(e)

Réponse donnée via Discord.

function packetJson(text: text) :: jsonobject:
  set {_t::*} to {_text} split by ""
  loop {_t::*}:
      if loop-value = """":
          set {_t::%loop-index%} to "\"""
      else if loop-value = "\":
          if {_t::%loop-index parsed as int + 1%} != "n":
              set {_t::%loop-index%} to "\\"
  set {_text} to join {_t::*} by ""
  if {_json} isn't set:
      set {_json} to "{""text"":""%{_text}%"""
  else:
      set {_json} to "%{_json}%,{""text"":""%{_text}%"""
  return json of string "{""extra"":[%{_json}%}],""text"":""""}"       

function AnvilGui(players: players, defaulttext: string="&bTexte Par Défaut"):
   loop {_players::*}:   
       set {_packet} to new play_server_open_window packet #Open GUI
       set string pinfo 0 of {_packet} to "minecraft:anvil"#Anvil
       set {ANVILGUI::%loop-value%} to random integer between 1 and 100 #RANDOM INV ID
       set "chatcomponent" pjson 0 of {_packet} to packetJson({_defaulttext})
       set int pnum 0 of {_packet} to {ANVILGUI::%loop-value%} #SET INV ID
       send loop-value packet {_packet}
       set {_packet} to new play_server_set_slot packet #Set Slot
       set int pnum 0 of {_packet} to {ANVILGUI::%loop-value%} #SET INV ID
       set int pnum 1 of {_packet} to 0
       set {_item} to "paper" parsed as item #Item (DEBUG Parse Error)
       set name of {_item} to {_defaulttext} #Default Text
       set "ItemModifier" pinfo 0 of {_packet} to {_item}
       send loop-value packet {_packet}
#DELETE VARIABLE
on packet event play_client_close_window:
   if int pnum 0 of event-packet = {ANVILGUI::%player%}: #Check if closed inventory is AnvilGUI
       clear {ANVILGUI::%player%}
       send "&c&lYou closed Anvil GUI."
on packet event play_client_window_click:  # Inv Click Checks
   if int pnum 0 of event-packet = {ANVILGUI::%player%}:
       cancel event
       update gui (player's current inventory)
       if int pnum 1 of event-packet = 0:
           set {_packet} to new play_server_set_slot packet #Set Slot
           set int pnum 0 of {_packet} to {ANVILGUI::%player%} #SET INV ID
           set int pnum 1 of {_packet} to 0
           set {_item} to "paper" parsed as item #Item (DEBUG Parse Error)
           set name of {_item} to "&bTexte Par Défaut" #Default Text
           set "ItemModifier" pinfo 0 of {_packet} to {_item} #Reset
           send player packet {_packet}
       if int pnum 1 of event-packet = 2:
           set {_final} to "ItemModifier" pinfo 0 of event-packet #GET CLICKED ITEM
           set {_name} to uncolored name of {_final} #REMOVE COLOR CODE
           {_name} is set #DEBUG SPAM CLICK
           # EDITABLE PART ( Use {_name} )
           send "&eResult : &f%{_name}%"
           clear {ANVILGUI::%player%}
           close player's inventory

#EXAMPLE

command /anvilgui <player>:
   trigger:
       AnvilGui(arg-1)
       #AnvilGui(arg-1, "Default")
#MundoSK - ProtocolLib - Skellett

 

 

Je lock.

Invité
Ce sujet ne peut plus recevoir de nouvelles réponses.
×
×
  • Créer...

Information importante

Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer.