minecraft

plexus 2022-05-17T08:48:01.612159Z

Workshop prep going great 😄

🎉 3
plexus 2022-05-17T09:20:51.387879Z

I'm releasing a new version which should make a lot of things a lot faster

🎉 2
plexus 2022-05-17T09:21:25.097789Z

Turns out clojure.core/satisfies? is really inefficient, and I'm using it all over the place 🙈 , but it's easy enough to cache

plexus 2022-05-17T09:21:50.768029Z

this new version also allows the :material in a cursor to be a function that returns a material

2022-05-17T11:40:32.927889Z

About perf, is there a recommended way to change lots of blocks at a time? I crashed the server more times than I would like to admit 😅

plexus 2022-05-17T13:19:13.494479Z

Yeah you can't lock up the server thread for too long... this might be better now with these recent improvements, depending on how much work witchcraft is doing to calculate the blocks.

plexus 2022-05-17T13:21:05.308679Z

otherwise what you can do is • wrap your code in future (or similar, take it off the rendering thread) • chunk up your total amount of blocks and draw them in batches • then you have to make sure any witchcraft/bukkit operations are wrapped in wc/run-task so they are scheduled on the server thread again

plexus 2022-05-17T13:22:26.451749Z

(future
  (doseq [batch (partition 1000 many-blocks)]
    (wc/run-task #(wc/set-blocks batch))))

plexus 2022-05-17T13:22:33.913769Z

^ something like this

plexus 2022-05-17T13:23:58.879449Z

I still haven't really figured out a good way to bulk change blocks in paper, for Glowstone we have a separate optimized codepath for this... for paper I haven't been able to find something like that. There's some good stuff in WorldEdit but then we'd have to add that as an extra dependency, and also haven't really figured out yet how to use it.

plexus 2022-05-17T13:24:35.491269Z

maybe this pattern could be made explicit though, (set-blocks ... {:async? true :batch-size 1000})

❤️ 1