Hi guys, I've spent too many hours trying to fix a problem. It is still unsolved so that's why I'm coming up to you. Basically I'm trying to spawn an ArmorStand using packets. Code (Java): EntityArmorStand ent = new EntityArmorStand(EntityTypes.ARMOR_STAND, ((CraftWorld) event.getPlayer().getWorld()).getHandle()); PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(ent); ent.setLocation(event.getPlayer().getLocation().getX(), event.getPlayer().getLocation().getY(), event.getPlayer().getLocation().getZ(), 0, 0); ent.getDataWatcher().set(new DataWatcherObject<>(0, DataWatcherRegistry.a), (byte) 0x20); ent.getDataWatcher().set(new DataWatcherObject<>(2, DataWatcherRegistry.f), Optional.of(CraftChatMessage.fromString("LOLLIPOP")[0])); ent.getDataWatcher().set(new DataWatcherObject<>(3, DataWatcherRegistry.i), true); ent.getDataWatcher().set(new DataWatcherObject<>(4, DataWatcherRegistry.i), true); ent.getDataWatcher().set(new DataWatcherObject<>(5, DataWatcherRegistry.i), true); PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(ent.getId(), ent.getDataWatcher(), false); ((CraftPlayer) event.getPlayer()).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata); ((CraftPlayer) event.getPlayer()).getHandle().playerConnection.sendPacket(packet); This is my current code (after multiple tests and stuff) and all this does is nothing ?? Yesterday using the same code with some modifications I was able to spawn an ArmorStand with a custom name but nothing else was working. I'm also trying to set it small, invisible, set as marker, etc. using this website https://wiki.vg/Entity_metadata#ArmorStand but it isn't working either... Please help
Maxx_Qc... I have bad news for you... Your ArmorStand ent is, in fact, not alive. I know, it's hard at first, but you gotta be stronger than this. Jokes aside, I don't think SpawnEntityLiving works. This worked for me (spawns a small armor stand with arms and a custom name): Code (Java): final EntityArmorStand armorStand = new EntityArmorStand(EntityTypes.ARMOR_STAND, world); armorStand.setPosition(loc.getX(), loc.getY(), loc.getZ()); armorStand.setCustomName(CraftChatMessage.fromStringOrNull("I am stand")); armorStand.setCustomNameVisible(true); armorStand.setSmall(true); armorStand.setPosition(loc.getX(), loc.getY(), loc.getZ()); armorStand.setArms(true); PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(armorStand); PacketPlayOutEntityMetadata metadata = new PacketPlayOutEntityMetadata(armorStand.getId(), armorStand.getDataWatcher(), true); final PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; connection.sendPacket(packetPlayOutSpawnEntity); connection.sendPacket(metadata);
I’ve got it to work with EntityLiving in the past, EntityArmorStand is extending from EntityLiving btw. I’ll try that code once I get back home, thanks a lot! EDIT: yeah it's working, thank you