Hello , Like you know, now in 1.9.2, instead of doing this (when creating a new datawatcher): Code (Text): DataWatcher watcher = new DataWatcher(null); watcher.a(6, (float) 20); We need to do this: Code (Text): DataWatcher watcher = new DataWatcher(null); watcher.set(DataWatcherRegistry.c.a(6), 20F); What I understood: In the last code, the variable "c" means that the second part of the method needs to be a java.lang.Float. And each variable from DataWatcherRegistry was created for a special type. For example: DataWatcherRegistry.h → java.lang.Boolean DataWatcherRegistry.d → java.lang.String Etcetera... Here is the list of all variables in DataWatcherRegistry class and their associated type: I want to use the variable f because i need to add an ItemStack to the dataWatcher. BUT, the variable f needs to be composed by the com.google.common.base.Optional class . So i've tested a lot of ways... Code (Text): watcher.set(DataWatcherRegistry.f.a(5), Optional.of(myItemStack)); Code (Text): watcher.set(DataWatcherRegistry.f.a(5), Optional.fromNullable(myItemStack)); But always → Null pointer exception (btw, the client was always kicked :/) So, i'm here to ask you if you know how i can specify my itemstack with the class Optional. I'm not a god in Java but i'm learning the basics so if how i explain things seems wrong, tell me how i can improve it. Thanks for reading and please help me :3 ♥ I'm French so sorry for my explanations. Any constructive idea is appreciated Note: My main aim is to spawn a firework without spawning it (just the sound of explosion) but that's not the problem here
I assume you want a new instance of it: Code (Java): Class<?> dataWatcherClass = Class.forName("net.minecraft.server." + Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3] + ".DataWatcher"); Constructor<?> dataWatcerConst = dataWatcherClass.getConstructor(); Object dataWatcher = dataWatcherConst.newInstance(); // Your DataWatcher object