Sunday, March 15, 2015

Kappa - Blockstates

I've made some additions to my annotation processor. I've added some new annotations for dealing with and automatically generating json blockstates and models.  The source is available on my Kappa Github repository.

The built jar is going to be a bit larger because I'm including gson with it. I do this so it works in eclipse without having to add another entry to the factory path.

Here's a short example on how to use this for Biomes O' Plenty.

  
@BlockDef(namespace = "biomesoplenty", blockname = "log", variants = {
        @BlockVariant(variant = "axis=y,variant=cherry", modelName = "cherry_log",
                modelType = ModelType.CUBE_COLUMN, textures = { "cherry_log_top", "cherry_log" })            @BlockVariant(variant = "axis=x,variant=cherry", modelName = "cherry_log",
                modelType = ModelType.CUBE_COLUMN, textures = { "cherry_log_top", "cherry_log" },
                pitch = 90),
        @BlockVariant(variant = "axis=z,variant=cherry", modelName = "cherry_log",
                modelType = ModelType.CUBE_COLUMN, textures = { "cherry_log_top", "cherry_log" },
                pitch = 90, yaw = 90)
})
Block log;

With the @BlockDef annotation, it can be placed on any field or variable, though preferably on a Block. You will give it arguments namespace and blockname. Namespace is your mod's ID or the domain your assets will be in. The variants argument is optional and will use the "normal" variant with a model of the same name as the block.

@BlockVariant will define both variants and models for the block def. All arguments are optional, so you can change what needs to be changed. You can rotate the model using pitch and yaw. The length of textures depends on modelType. See ModelType for a full list of models and their arguments.

No comments:

Post a Comment