Code Monkey home page Code Monkey logo

Comments (6)

ShaneBeee avatar ShaneBeee commented on September 15, 2024

My guess is your NBT is invalid

from skbee.

 avatar commented on September 15, 2024

I have fixed the display tag but I still get no formating errors.
I already use the exact same tags outside an entity without problems.

For exemple:

function itemsNbt() :: text:
	set {_id} to random integer between 0 and 4294967296
	return "{display:{Name:'{""text"":"" ""}'},HideFlags:63,id:%{_id}%,CanPlaceOn:[%{blocks}%]}"

... to close then run function manufacturingValidate({_p},unlit campfire with nbt itemsNbt(),5 stick)

from skbee.

ShaneBeee avatar ShaneBeee commented on September 15, 2024

Hmm I'm not really sure what to tell ya.
Have you tried applying this NBT via vanilla commands?
Quite often people make mistakes in their NBT and immediately blame me, when its just user error.
Try spawn a dropped item with vanilla commands and the same NBT tag and see what happens.

As for testing, I can't test this since I don't actually know what's in your {blocks} variable.

from skbee.

 avatar commented on September 15, 2024

Yeah of course, I understand.
No I'm not using vanilla command, but I get no problem with the vanilla command too. I'm using SkBee directly to use thoses nbt tags somewhere else in my code without problems except in the item spawn event.

The {blocks} is a long string that contains all the formated vanilla named blocks I want the block to be placed on. I got the same problem without this.

This is the point of my problem. I got no problems except in this specific case. I can't set, add or reset any tags in the even-item.

This example is perfectly working:

command /test:
	trigger:
		give stick with nbt "{HideFlags:63}" to player

This is two basic examples of code which doesn't work.

on item spawn:
	broadcast nbt of event-item
	add "HideFlags:63" to nbt of event-item
	broadcast nbt of event-item

or

on item spawn:
	broadcast nbt of event-item
	reset nbt of event-item
	broadcast nbt of event-item

In this last example, I can give me a stick with "{HideFlags:63}" tag with the vanilla command, but it doesn't reset the tags when the item is spawned on my feet or when I drop it from my inventory.
The broadcasts display both {HideFlags:63}

from skbee.

ShaneBeee avatar ShaneBeee commented on September 15, 2024

Ok looking thru Skript's code, this appears to be a Skript issue.
When using event-item, Skript creates a new item type based on the item stack of the entity.
This in itself is a clone of the original item, so applying NBT to it, won't translate back to the original item.

That said 2 things you could do:

  1. You could add NBT to the event-entity. The issue with this is the NBT of an entity will be a bit different than the item
  2. You could get the item, cancel the event (preventing the item spawning), add NBT to the item and drop it (therefor spawning a new item)

from skbee.

 avatar commented on September 15, 2024

Ok, Thank you for your research. :)

  1. I will try to see how I can edit subtag in the item tag of the entity without a complexe string manipulation.
  2. I doesn't take the item velocity since it's in the entity which is not that great when dropping an item from the player's inventory. Dropping an item with skript will also trigger the item spawn event and stop the skript since it's create an infinite loop.

from skbee.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.