@@ -19,16 +19,32 @@ Addons with custom pipe implementations will have to tweak their code slightly t
1919 @Override
2020- public PipeModel getPipeModel() {
2121- return model;
22- + public PipeModel createPipeModel() {
23- + return PipeModel.create (this, pipeType.getThickness(), [side texture], [end texture], null, null );
22+ + public PipeModel createPipeModel(GTBlockstateProvider provider ) {
23+ + return new PipeModel(this, pipeType.getThickness(), [side texture], [end texture], provider );
2424 }
2525```
26-
27- You must also add a ** Forge bus** event listener for ` RegisterDynamicResourcesEvent ` , like so:
26+ If your pipe is generated from a material property (or equivalent), you should also call ` PipeModel#dynamicModel() `
27+ to have models be generated at runtime.
28+ If so, must also add a ** Mod bus** event listener for ` RegisterDynamicResourcesEvent ` , like so:
2829``` java
2930@SubscribeEvent
3031public static void registerDynamicResources(RegisterDynamicResourcesEvent event) {
31- for (var block : MyBlocks . MY_PIPE_BLOCKS ) block. get(). createPipeModel();
32+ for (var block : MyBlocks . MY_PIPE_BLOCKS ) block. get(). createPipeModel(RuntimeExistingFileHelper . INSTANCE ) . dynamicModel( );
3233}
3334```
3435Replace ` MyBlocks.MY_PIPE_BLOCKS ` with a reference to your pipe block array/map value collection.
36+
37+
38+ Conversely, if the pipe is ** not** generated, but has a constant set of variants (such as optical fiber cables or laser pipes),
39+ you should ** NOT** use ` PipeModel#dynamicModel() ` and instead set the model with ` GTBlockBuilder#gtBlockstate ` as such:
40+ ``` java
41+ // on your pipe block builder
42+ ... = REGISTRATE . block(... )
43+ .properties(... )
44+ .gtBlockstate(GTModels :: createPipeBlockModel)
45+ .. . more builder things. ..
46+ .item(... )
47+ .model(NonNullBiConsumer . noop())
48+ .. . more builder things. ..
49+ ```
50+ This makes the pipe model(s) be generated for you without having to process them at runtime.
0 commit comments