Welcome on MasterOf13FPS! MasterOf13FPS

Register today or sign up if you are already a member and never miss any cool content again :)

Closed NBT Spawn Eggs wont work

Status
Not open for further replies.

MasterOf13FPS

Administrator
Staff member
Administrator
MasterOf13FPS
Joined
Jul 11, 2020
Messages
0
Reaction score
25
Points
0
Hey,
I wanted to get a spawnegg wich is modified with nbt tags.
My problem is i only get a white spawnegg and i dont know how to set the Entity Id to the spawnegg. Currently i got this:

Code:
ItemStack itm = new ItemStack(Items.spawn_egg);
NBTTagCompound base = new NBTTagCompound();
NBTTagCompound entityTag = new NBTTagCompound();
entityTag.setString("id", "Creeper");

NBTTagList pos = new NBTTagList();
pos.appendTag(new NBTTagDouble(x));
pos.appendTag(new NBTTagDouble(y));
pos.appendTag(new NBTTagDouble(z));
         
entityTag.setTag("Pos", pos);
entityTag.setInteger("Fuse", 0);
entityTag.setInteger("ExplosionRadius", 30);
base.setTag("EntityTag", entityTag);
itm.setTagCompound(base);

Notiz: Der neue Code steht weiter unten in diesem Thread.

-Slimig (Master_Coder)

30.09.2018 - by FantaCoke
- Code neu formatiert
- Notiz hinzugefügt
 
Last edited by a moderator:
Ye @FantoCoke said that's useless and I will remove it when I am next time on my laptop. Is that the reason why it wont works?
 
Ye @FantoCoke said that's useless and I will remove it when I am next time on my laptop. Is that the reason why it wont works?
Da ich weiß, dass du Deutsch verstehst, schreibe ich auf Deutsch.

Es ist möglich, dass das der Grund ist. Im Grunde überschreibst du die definierten Sachen mit neuen Sachen, wo es nicht mehr definiert ist.
Einfach mal weglassen. Dennoch bin ich skeptisch, weil es eigentlich ein Mobtype sein sollte und kein String.
 
So habe ich es jetzt geht aber auch nicht. Wie kann ich denn den Mobtype setzen?

Code:
 ItemStack itm = new ItemStack(Items.spawn_egg);
           NBTTagCompound base = new NBTTagCompound();
           base.setString("id", "Creeper");
           
           NBTTagList pos = new NBTTagList();
           pos.appendTag(new NBTTagDouble(x));
           pos.appendTag(new NBTTagDouble(y));
           pos.appendTag(new NBTTagDouble(z));
           
           base.setTag("Pos", pos);
           base.setInteger("Fuse", 0);
           base.setInteger("ExplosionRadius", 30);
           itm.setTagCompound(base);
 
Wir haben die Lösung gefunden - es hat sich erledigt.

//closed
 
Status
Not open for further replies.
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top