Aller au contenu
  • 0

Détection quand l'item est dans la main.


Question

Posté(e) (modifié)

Version de Minecraft : 1.8
Version de Skript : 2.2-Fixes-V8b

Type du skript : Skript utilitaire

Description du script :

Bonjour je souhaiterais avoir un peut d'aide sur un skript.

J'ai copié le skript de Mathitux de l'unclaim finder. Lui il faut faire clique droit sur une clock pour affiché dans le chat un message.

Moi je voudrais que quand le joueur a la clock dans la main, au lieu de faire clique droit et de le marqué dans le chat, je voudrais qu'il se marque en tant que "send action bar from "&b%{_chest}% coffre(s) &7ont été trouvés sur ce chunk" to player" et que toute les secondes sa recharge le send action pour éviter qui parte.

#Inspiration de PalaItems fait Par KyloRen3600
#Recoddé par Mathitux

on script load:
	register new shaped recipe for clock named "&6&lUnclaim Finder" with lore "Analyse 1 chunk" using gold ingot, gold ingot, gold ingot, gold ingot, emerald, gold ingot, gold ingot, gold ingot, gold ingot

on right click with clock:
	if name of tool of player is "&6&lUnclaim Finder":
		set {_chest} to 0
		loop blocks within chunk at player:
			if loop-block is a chest:
				add 1 to {_chest}
			if loop-block is an ender chest:
				add 1 to {_chest}
			if loop-block is a trapped chest:
				add 1 to {_chest}
			if loop-block is a dispenser:
				add 1 to {_chest}
			if loop-block is hopper:
				add 1 to {_chest}
			if loop-block is Dropper:
				add 1 to {_chest}
			if loop-block is Minecart with hopper:
				add 1 to {_chest}
			if loop-block is Minecart with chest:
				add 1 to {_chest}
		wait 1 tick
		send action bar from "&b%{_chest}% coffre(s) &7ont été trouvés sur ce chunk" to player

every second:
    loop all players:
        send action bar from "&b%{_chest}% coffre(s) &7ont été trouvés sur ce chunk" to loop players

Merci de votre aide et bonne journée.

Modifié par EnzoDev

7 réponses à cette question

Messages recommandés

  • 0
Posté(e)

C'est pas ouf ton idée, vraiment pas optimisé, et ça peut faire un peu lag. Je peux te proposer un compromis, le joueur clique sur l'item, et le temps qu'il le garde dans sa main, cela lui indique les coffres aux alentours. Dit moi si cela te convient ^^

Autrement, ce code est largement réductible, je me demande bien qui l'a fait :

on script load:
	register new shaped recipe for clock named "&6&lUnclaim Finder" with lore "Analyse 1 chunk" using gold ingot, gold ingot, gold ingot, gold ingot, emerald, gold ingot, gold ingot, gold ingot, gold ingot

on right click with clock:
	if name of player's tool is "&6&lUnclaim Finder":
		set {_chest} to 0
		loop blocks within chunk at player:
			if loop-block is chest or ender chest or trapped chest or dispenser or hopper or dropper or minecart with hopper or minecart with chest:
				add 1 to {_chest}
		wait 1 tick
		send action bar from "&b%{_chest}% coffre(s) &7ont été trouvés sur ce chunk" to player


Voilà, c'est pas grand chose, mais ça débroussaille les fougères comme on dit chez moi

  • J'aime 1
  • 0
Posté(e)
Il y a 9 heures, Lou' a dit :

C'est pas ouf ton idée, vraiment pas optimisé, et ça peut faire un peu lag. Je peux te proposer un compromis, le joueur clique sur l'item, et le temps qu'il le garde dans sa main, cela lui indique les coffres aux alentours. Dit moi si cela te convient ^^

Autrement, ce code est largement réductible, je me demande bien qui l'a fait :


on script load:
	register new shaped recipe for clock named "&6&lUnclaim Finder" with lore "Analyse 1 chunk" using gold ingot, gold ingot, gold ingot, gold ingot, emerald, gold ingot, gold ingot, gold ingot, gold ingot

on right click with clock:
	if name of player's tool is "&6&lUnclaim Finder":
		set {_chest} to 0
		loop blocks within chunk at player:
			if loop-block is chest or ender chest or trapped chest or dispenser or hopper or dropper or minecart with hopper or minecart with chest:
				add 1 to {_chest}
		wait 1 tick
		send action bar from "&b%{_chest}% coffre(s) &7ont été trouvés sur ce chunk" to player


Voilà, c'est pas grand chose, mais ça débroussaille les fougères comme on dit chez moi

Merci beaucoup 🙂

  • 0
Posté(e) (modifié)
il y a 29 minutes, EnzoDev a dit :

Merci beaucoup 🙂

Salut, voici ton Skript (je me suis appuyé sur la modification de Lou') :

on script load:
	register new shaped recipe for clock named "&6&lUnclaim Finder" with lore "Analyse 1 chunk" using gold ingot, gold ingot, gold ingot, gold ingot, emerald, gold ingot, gold ingot, gold ingot, gold ingot

function chest(p: player):
	set {_chest} to 0
	loop blocks within chunk at {_p}:
		if loop-block is chest or ender chest or trapped chest or dispenser or hopper or dropper or minecart with hopper or minecart with chest:
			add 1 to {_chest}
	send action bar "&6%{_chest}% coffre(s) &eont été trouvés dans ce chunk" to {_p}

on tool change:
	if tool of player is a clock named "&6&lUnclaim Finder":
		while tool of player is a clock named "&6&lUnclaim Finder":
			chest(player)
			wait 1 second

J'espère que ça fonctionnera, dis-moi ! 😛

Modifié par Romitou
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.