Posted January 17, 20214 yr Hello, Prior, one could implement IPerspectiveAwareModel to have an item render differently based on hand or GUI. This is no longer the case. I see that when registering an item I can call .setISTER() and provide my own implementation of an ItemStackTileEntityRenderer, but that's used to render a different 3D model instead of just a flat icon. I also found that I couldn't get the method ItemStackTileEntityRenderer.render to even be called if I attached it to an item. Is there a better way to accomplish what I want to do, or do I just have to make a 3D model that looks like a 2D icon for the sake of this? How do I even get it to invoke if that is the case? Edited January 21, 20214 yr by Woodside
January 17, 20214 yr Author 40 minutes ago, diesieben07 said: In 1.16 Forge has SeparatePerspectiveModel, which you can trivally port to 1.15. Seem to be missing RenderMaterial which I cannot find.
January 17, 20214 yr Author 1 minute ago, diesieben07 said: Well, you need to adjust the overrides. I replaced RenderMaterial with Material and it seems to be happy. Wonder if that were just a rename. I also had to rename isSideLite to func_230044_c_ but that wasn't an issue.
January 17, 20214 yr Author I do not believe I understand how to apply SeparatePerspectiveModel. How do I tell a specific item to use it?
January 17, 20214 yr Author 59 minutes ago, poopoodice said: You can replace with your own model through ModelBakeEvent. How do I create the model to replace with though? Instantiate a couple of BlockModels, and put them into a new SeparatePerspectiveModel, and then run "bake"? I can't find all the parameters I need to put into bake.
January 18, 20214 yr Author 7 hours ago, diesieben07 said: No. No no no. You use "loader": "yourmod:your_loader" in your block's JSON model. The JSON data will then be passed to your loader to be loaded. Loader, is that another class I extend off of? Is that SeparaterPerspectiveModel? I really have no context for how these pieces of information fit together. Can you explain with some more detail?
January 20, 20214 yr Author @diesieben07 Alright so I have the following, and the base model seems to be functioning just fine. However the GUI perspective just shows up as blank. No "missing model/texture" purple and black icon, just blank. Any idea why that might be? I put some log messages in the code and found that it is detecting the GUI item model, and is loading it. It's just not doing it correctly for some reason. { "loader": "mymodid:separate-perspective", "base": { "textures": { "0": "mymodid:item/flintlock", "particle": "mymodid:item/flintlock" }, "elements": [ { "from": [7, 6.75, -3], "to": [9, 8.75, 6], "rotation": {"angle": 0, "axis": "y", "origin": [8, 7.00105, 7.80305]}, "faces": { "north": {"uv": [9.5, 2.5, 11.5, 0.5], "texture": "#0"}, "east": {"uv": [0, 2, 9, 0], "rotation": 180, "texture": "#0"}, "south": {"uv": [9.5, 2.5, 11.5, 0.5], "texture": "#0"}, "west": {"uv": [0, 0, 9, 2], "texture": "#0"}, "up": {"uv": [0, 2, 9, 0], "rotation": 90, "texture": "#0"}, "down": {"uv": [0, 0, 9, 2], "rotation": 270, "texture": "#0"} } }, { "from": [8, 8.75, -3], "to": [8, 9.75, -1], "rotation": {"angle": 0, "axis": "y", "origin": [8, 7.00105, 7.80305]}, "faces": { "north": {"uv": [0, 0, 2, 1], "texture": "#0"}, "east": {"uv": [6, 15, 4, 16], "texture": "#0"}, "south": {"uv": [0, 0, 2, 1], "texture": "#0"}, "west": {"uv": [4, 15, 6, 16], "texture": "#0"}, "up": {"uv": [0, 0, 2, 1], "texture": "#0"}, "down": {"uv": [0, 0, 2, 1], "texture": "#0"} } }, { "from": [6.5, 7.75, 6], "to": [9.5, 8.75, 13], "rotation": {"angle": 0, "axis": "y", "origin": [8, 7.00105, 7.80305]}, "faces": { "north": {"uv": [6, 10, 3, 11], "texture": "#0"}, "east": {"uv": [7, 3, 14, 4], "texture": "#0"}, "south": {"uv": [13, 0, 12, 3], "rotation": 90, "texture": "#0"}, "west": {"uv": [14, 3, 7, 4], "texture": "#0"}, "up": {"uv": [9, 9, 6, 16], "texture": "#0"}, "down": {"uv": [7, 0, 0, 1], "texture": "#0"} } }, { "from": [6.5, 4.75, 2], "to": [9.5, 7.75, 13], "rotation": {"angle": 0, "axis": "y", "origin": [8, 7.00105, 7.80305]}, "faces": { "north": {"uv": [6, 11, 3, 14], "texture": "#0"}, "east": {"uv": [14, 4, 3, 7], "texture": "#0"}, "south": {"uv": [16, 0, 13, 3], "rotation": 270, "texture": "#0"}, "west": {"uv": [3, 4, 14, 7], "texture": "#0"}, "up": {"uv": [3, 3, 0, 14], "rotation": 180, "texture": "#0"}, "down": {"uv": [3, 3, 0, 14], "texture": "#0"} } }, { "from": [8, 2.75, 10], "to": [8, 4.75, 14], "rotation": {"angle": 0, "axis": "y", "origin": [8, 7.00105, 7.80305]}, "faces": { "north": {"uv": [0, 0, 4, 2], "texture": "#0"}, "east": {"uv": [4, 14, 0, 16], "texture": "#0"}, "south": {"uv": [0, 0, 4, 2], "texture": "#0"}, "west": {"uv": [0, 14, 4, 16], "texture": "#0"}, "up": {"uv": [0, 0, 4, 2], "texture": "#0"}, "down": {"uv": [0, 0, 4, 2], "texture": "#0"} } }, { "from": [8, 8.75, 10], "to": [8, 9.75, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 7.00105, 7.80305]}, "faces": { "north": {"uv": [0, 0, 2, 1], "texture": "#0"}, "east": {"uv": [6, 15, 4, 16], "texture": "#0"}, "south": {"uv": [0, 0, 2, 1], "texture": "#0"}, "west": {"uv": [4, 15, 6, 16], "texture": "#0"}, "up": {"uv": [0, 0, 2, 1], "texture": "#0"}, "down": {"uv": [0, 0, 2, 1], "texture": "#0"} } }, { "from": [7, -4.43706, 9.71454], "to": [9, 4.56294, 12.71454], "rotation": {"angle": -45, "axis": "x", "origin": [8, 7.00105, 7.80305]}, "faces": { "north": {"uv": [9, 7, 11, 16], "texture": "#0"}, "east": {"uv": [13, 7, 16, 16], "texture": "#0"}, "south": {"uv": [11, 7, 13, 16], "texture": "#0"}, "west": {"uv": [16, 7, 13, 16], "texture": "#0"}, "up": {"uv": [0, 0, 3, 9], "texture": "#0"}, "down": {"uv": [14, 4, 16, 7], "texture": "#0"} } } ], "display": { "thirdperson_righthand": { "rotation": [60, 0, 0], "translation": [0, 4, 1], "scale": [0.55, 0.55, 0.55] }, "thirdperson_lefthand": { "rotation": [60, 0, 0], "translation": [0, 4, 1], "scale": [0.55, 0.55, 0.55] }, "firstperson_righthand": { "translation": [1, 3, 1], "scale": [0.68, 0.68, 0.68] }, "firstperson_lefthand": { "translation": [1, 3, 1], "scale": [0.68, 0.68, 0.68] }, "ground": { "translation": [0, 2, 0], "scale": [0.5, 0.5, 0.5] }, "gui": { "rotation": [30, 45, 0], "scale": [0.625, 0.625, 0.625] }, "head": { "rotation": [0, 180, 0], "translation": [0, 13, 7] }, "fixed": { "rotation": [90, 60, -90], "translation": [1, 2, 0] } }, "groups": [ { "name": "pistol Breech", "origin": [8, 7.00105, 7.80305], "children": [0, 1] }, { "name": "pistol", "origin": [8, 7.00105, 7.80305], "children": [2, 3, 4, 5, 6] } ] }, "perspectives": { "gui": { "parent": "item/generated", "textures": { "layer0": "mymodid:item/flintlock_icon" } } } }
January 20, 20214 yr Author I have found also that setting the "base" model to be "item/generated" also results in a blank hand-held item. Something about SeparatePerspectiveModel doesn't like stock item models, it seems? EDIT: I see now that I cannot use existing model templates due to them requiring their own model loader... So I'll need to make the item model from scratch. EDIT2: Upon further inspection, it should still be trying to use the appropriate model loader for items when SeparatePerspectiveModel deserializes the perspective objects. So I am confused as to why it's not working. Edited January 20, 20214 yr by Woodside
January 20, 20214 yr Author 13 hours ago, diesieben07 said: Item models are generated at runtime, this is handled by Forge in 1.16, but not in 1.15. It is easy to fix though, see the following change you need to make (this is not necessary in 1.16, only when copying this to 1.15): https://github.com/MinecraftForge/MinecraftForge/compare/1.16.x...diesieben07:separate-perspective-itemmodel Thanks for the diff! Nearly there, except the 2D GUI icon is darker than other 2D items. Is there some flag I need to set?
January 21, 20214 yr Author In the BakedModel class in SeparatePerspectiveModel, I changed func_230044_c_()/isSideLit() to return always false. That fixed the lighting issue with the GUI icon, but I cannot tell if it had any effect on the 3D model or not. It doesn't seem to have.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.