Fork me on GitHub
#minecraft
<
2022-01-04
>
plexus02:01:37

okay, couldn't help myself, some more progress on Citizens @devurandom https://github.com/lambdaisland/witchcraft/pull/8/files

devurandom20:01:39

Thanks, this looks awesome! I will review it tomorrow.

devurandom19:01:13

Thanks for the explanations! They helped me a lot in understanding some choices you made for Witchcraft.

devurandom21:01:54

@U07FP7QJ0 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?

plexus02:01:37

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

🎉 2