A tale of model definition bug hunting

After updating all code that deals with DED Model definitions to use the new Record based storage, I was slightly disappointed — although not surprised — to see that loading up a resource pack and trying to use it would result in a crash.

This is a pattern that I’ve come to accept as the norm: after working on a set of significant changes, my initial design and plan are shown to be valid, but I have to spend a couple of hours tracking down bugs that, in the end, prove to be trivial. In other words, one can’t expect to write bug free code.

Continue reading A tale of model definition bug hunting

Easier native access to Record

While working on the Record based definitions, I noticed that there is a clear redundancy in the get*() methods: they pop up in Record, Config, and now I also needed them in a utility class that manipulates model definition data stored in a Record.

The solution was to add a new class called RecordAccessor that contains nothing but these get*() methods. This new class can then be inherited into any other class that benefits from providing native access to a Record.

While RecordAccessor is currently specific to Record instances, it could still be generalized into an IAccessor class that queries values from an abstract source where values are addressed using paths — this would make it possible to use it also with PathTree.