Question try createBlockData got java.lang.NullPointerException: null

creamgod45

New member
Oct 31, 2024
3
0
1
Server Version: paper-1.21.1-130.jar , paper-1.21.1-128.jar
JDK: 21

I have tried three ways to create it but none of them worked and the error message shown in the picture appeared. Does anyone have a better way?
error log
1730357719686.png
Java:
World world = player.getWorld();
Location location = player.getLocation();
BlockDisplay display = world.spawn(location, BlockDisplay.class);
// 1
display.setBlock(Material.END_CRYSTAL.createBlockData());
// 2
display.setBlock(Bukkit.createBlockData(Material.END_CRYSTAL));
// 3
BlockData blockData = player.getServer().createBlockData(Material.END_CRYSTAL);
display.setBlock(blockData);
 
Logs
https://paste.gg/p/anonymous/11d168c613594e879e94ce7cfe52c7df
Version Output
paper-1.21.1-130.jar, paper-1.21.1-128.jar

creamgod45

New member
Oct 31, 2024
3
0
1
Java:
ItemDisplay itemDisplay = world.spawn(location, ItemDisplay.class, entity -> {
    entity.setItemStack(new ItemStack(Material.END_CRYSTAL));
});

int duration = 5 * 20; // duration of half a revolution (5 * 20 ticks = 5 seconds)

Matrix4f mat = new Matrix4f().scale(0.5F); // scale to 0.5x - smaller item
Bukkit.getScheduler().runTaskTimer(plugin, task -> {
    if (!itemDisplay.isValid()) { // display was removed from the world, abort task
        task.cancel();
        return;
    }

    itemDisplay.setTransformationMatrix(mat.rotateY(((float) Math.toRadians(180)) + 0.1F /* prevent the client from interpolating in reverse */));
    itemDisplay.setInterpolationDelay(0); // no delay to the interpolation
    itemDisplay.setInterpolationDuration(duration); // set the duration of the interpolated rotation
}, 1 /* delay the initial transformation by one tick from display creation */, duration);


1730359514133.png

what is this Material enum name
1730359523401.png