Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Looking at ModelDynBucket, 4 classes are important.
- ModelDynBucket itself (IModel), LoaderDynBucket (ICustomModelLoader), BakedBucketOverrideHandler (ItemOverrideList) (this is how we actually know which fluid to use), and BakedDynBucket (IBakedModel).
- So the forge bucket item is registered to the mrl "forge:dynbucket" (change to maybe "ore_pings:ping"). This is an ordinary blockstate json, open it and analyze it. Basically it just passes some data into the actual "forge:forgebucket" (maybe "ore_pings:ping_special") custom model.
- Because the blockstate refers to "forge:forgebucket" ("ore_pings:ping_special"), LoaderDynBucket is called upon to "load" the model, and it just returns a static dummy model which is untextured.
- Then the texture and custom data is passed to ModelDynBucket.MODEL with `retexture` and `process`, which returns a new ModelDynBucket with this data.
- This new ModelDynBucket is now the model registered to the item (it's actually wrapped in a blockstate WeightedRandomModel but that does nothing).
- Then this ModelDynBucket is `bake`d, and this creates a BakedDynBucket (which looks like a water bucket (maybe use stone, empty, or missingno as your dummy?) bc that's what's in the json). Math happens here.
- When the BakedDynBucket is being rendered, first thing that happens, if it is an item, is the override handler, BakedBucketOverrideHandler, is invoked to process the itemstack specific data.
- commas ftw
- The `handleItemState` finds the fluid (ore) in the item, gets the parent ModelDynBucket from the BakedDynBucket, and creates a new ModelDynBucket with a new fluid (ore).
- The ModelDynBucket gets baked into a new IBakedModel with the new fluid (ore).
- The new BakedDynBucket is cached in the original BakedDynBucket. (When the resourcepacks reload, all models are reloaded and rebaked; therefore, the cache is thrown away automatically.)
- The BakedDynBucket with the correct fluid (ore) is then returned from handleItemState, therefore causing the rest of the system to replace the original water bucket (stone) model with it.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement