-
Notifications
You must be signed in to change notification settings - Fork 0
ModelData
PModelData is PulseLib’s way of linking your animatable’s GLB model files and textures.
With PulseLib, you can assign as many textures as you like to each model in your game.
Every renderer in PulseLib requires a corresponding PModelData, so it’s essential to create one for each renderer you implement.
To create a new PModelData, create a class that extends or uses PModelData
Example PModelData
new PModelData.Builder(ResourceLocation.fromNamespaceAndPath("test_mod", "glmodels/block/test_block.glb")).
addTexture(ResourceLocation.fromNamespaceAndPath("test_mod", "block/test_block/tube")).
addTexture(ResourceLocation.fromNamespaceAndPath("test_mod", "block/test_block/torus")).
addTexture(ResourceLocation.fromNamespaceAndPath("test_mod", "block/test_block/pyramid")).
addTexture(ResourceLocation.fromNamespaceAndPath("test_mod", "block/test_block/cube")).
build();For convenience, PulseLib includes prebuilt default classes for most common model types:
It is highly recommended to use these default classes whenever possible.
PulseLib requires that your models and textures reside in specific folders within your resources directory. This ensures that PulseLib can locate them automatically. You can organize subdirectories freely, as long as your PModelData points to the correct paths.
Place your model files in:
resources/assets/<modid>/glmodels
Textures follow the standard Minecraft structure:
resources/assets/<modid>/textures
For models and textures any subfolders allowed
PulseLib provides preconfigured PModelData classes for quick setup. Using them:
- Saves time
- Encourages consistent file organization
Click
new DefaultBlockModelData.DefaultBlockModelDataBuilder(ResourceLocation.fromNamespaceAndPath("test_mod", "test_block")).
addTexture(ResourceLocation.fromNamespaceAndPath("test_mod", "tube")).
addTexture(ResourceLocation.fromNamespaceAndPath("test_mod", "torus")).
addTexture(ResourceLocation.fromNamespaceAndPath("test_mod", "pyramid")).
addTexture(ResourceLocation.fromNamespaceAndPath("test_mod", "cube")).
build();This automatically sets the following paths:
Textures: block/test_block/tube
block/test_block/torus
block/test_block/pyramid
block/test_block/cube
Model: glmodels/block/testblock.glb
Note
Texture name in code and in blockbench should be same. For detailed breakdown about texture check this page: Texture Handling
Start
Basics
In depth
Specifics