okay, couldn't help myself, some more progress on Citizens @devurandom https://github.com/lambdaisland/witchcraft/pull/8/files
Thanks for the explanations! They helped me a lot in understanding some choices you made for Witchcraft.
Thanks, this looks awesome! I will review it tomorrow.
@plexus I tried to send the citizens and the citizens.trait namespaces through my REPL to the server and then did:
(ns
(:require
[lambdaisland.witchcraft :as wc]
[lambdaisland.witchcraft.citizens :as citizens]))
; => nil
(citizens/make-trait "mytrait"
{:on-attach
(fn [this]
(println "mytrait attached to" (.getNPC this)))})
I get the reply:
Execution error (ClassFormatError) at java.lang.ClassLoader/defineClass1 (ClassLoader.java:-2).
Illegal field name "lambdaisland.witchcraft.citizens.trait_SLASH_trait_post_init__var" in class my/name/space
What is my mistake?Found the issue and was able to fix it: https://github.com/lambdaisland/witchcraft/pull/8#discussion_r781582201
I realized that just calling .addTrait with a trait instance will break citizens persistence and restore, so I came up with what I think is an elegant solution, wrapping a call to gen-class but loading it directly into memory instead of writing out a class file