CottonMC / AnsarersJsonCreator

This is a hacked together solution for auto generating json files.
Creative Commons Zero v1.0 Universal
0 stars 1 forks source link

Annotation based blockstate templating #2

Open Frontrider opened 5 years ago

Frontrider commented 5 years ago

1

An extremely rough around the edges example:

@Pillar
@Modid(MODID)//no explanation needed
@InitNames({"logone","logtwo"})
class MyLog extends Block(Material.of(WOOD)){}

@BlockProperty(name="axis",type=Axis) //axis can either be an enum, or the minecraft axis class
@Texture({"%name%_side","%name%_top"})
@ModelParent("block/pillar") 
@interface Pillar(){}

What it does:

Note the nested annotation. That is a concept that I got familiar with when I started to work with Junit5. This technology can be used for extensive metaprogramming, and templating.

LemmaEOF commented 5 years ago

I think you forgot a quote after %name%_top

Frontrider commented 5 years ago

Modifying code during this phase is usually messy, but we could go around the problem by generating a mixin that applies the required modifications to our class.