Example:
Code (Text):
public static void boneMeal(Location location) {
ReflectionUtil.newCall().getMethod(CRAFT_WORLD, "getHandle")
.get()
.passIfValid(reflectionMethod -> {
Object world = reflectionMethod.invokeIfValid(location.getWorld());
ReflectionUtil.newCall().getMethod(ITEM_DYE, "a", NMS_ITEM_STACK, NMS_WORLD, NMS_BLOCK_POSITION)
.get()
.passIfValid(reflectionMethod1 -> {
ReflectionUtil.newCall().getConstructor(NMS_BLOCK_POSITION, int.class, int.class, int.class)
.get()
.passIfValid(reflectionConstructor -> {
Object blockPosition = reflectionConstructor.newInstance((int) location.getX(), (int) location.getY(), (int) location.getZ());
reflectionMethod1.invokeIfValid(null, NMSItemStack, world, blockPosition);
});
});
});
}