minecraft

plexus 2022-01-04T02:39:37.053500Z

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

devurandom 2022-01-05T19:26:13.055400Z

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

devurandom 2022-01-04T20:07:39.055Z

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

devurandom 2022-01-10T21:38:54.000100Z

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

devurandom 2022-01-10T21:49:14.000300Z

Found the issue and was able to fix it: https://github.com/lambdaisland/witchcraft/pull/8#discussion_r781582201

plexus 2022-01-04T02:40:37.054800Z

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