FLUFFY2 Posted November 7, 2015 Posted November 7, 2015 Hi, I was about to publish my mod, but i noticed that after i updated to the latest Forge, the PerspectiveAwareModel got messed up. Neither the vanilla(RenderItem.applyVanillaTransform) or the Forge(ForgeClientHooks.getMatrix) transform got applied. Basically if i change the .json file the model is still the default. I really dont want to use GlStateManager to rotate it back. Thanks! Quote
jeffryfisher Posted November 7, 2015 Posted November 7, 2015 Is this a mod help plea or a bug report? Quote The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
FLUFFY2 Posted November 7, 2015 Author Posted November 7, 2015 In Build 1.8-11.14.3.1529, they did something to the PerspectiweAwareModel, and its not working. In Build 1.8-11.14.3.1525, its working fine! Quote
LexManos Posted November 7, 2015 Posted November 7, 2015 Supply code and example, I'll yell at fry to fix it. He's the one dealing with this crap Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
FLUFFY2 Posted November 7, 2015 Author Posted November 7, 2015 Okay, here you go. Model class public class ModelLanternOn implements ISmartItemModel, IPerspectiveAwareModel{ public static final ModelResourceLocation modelLanternOn = new ModelResourceLocation(AmnesiaLights.ModID + ":LanternOn", "inventory"); public IBakedModel LanternOn; public Minecraft mc; public ModelLanternOn(IBakedModel LanternOn){ this.LanternOn = LanternOn; this.mc = Minecraft.getMinecraft(); } @Override public IBakedModel handleItemState(ItemStack stack){ return this; } @Override public List getFaceQuads(EnumFacing p_177551_1_){ return LanternOn.getFaceQuads(p_177551_1_); } @Override public List getGeneralQuads(){ return LanternOn.getGeneralQuads(); } @Override public boolean isAmbientOcclusion(){ return LanternOn.isAmbientOcclusion(); } @Override public boolean isGui3d(){ return LanternOn.isGui3d(); } @Override public boolean isBuiltInRenderer(){ return false; } @Override public TextureAtlasSprite getTexture(){ return LanternOn.getTexture(); } @Override @Deprecated public ItemCameraTransforms getItemCameraTransforms(){ return LanternOn.getItemCameraTransforms(); } @Override public Pair<IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType){ switch (cameraTransformType){ case FIRST_PERSON: this.renderFirstPersonArm();//Not the problem, same without this!!! RenderItem.applyVanillaTransform(LanternOn.getItemCameraTransforms().firstPerson); return Pair.of(LanternOn, null); case THIRD_PERSON: RenderItem.applyVanillaTransform(LanternOn.getItemCameraTransforms().thirdPerson); return Pair.of(LanternOn, null); case GUI: RenderItem.applyVanillaTransform(LanternOn.getItemCameraTransforms().gui); return Pair.of(LanternOn, null); case HEAD: RenderItem.applyVanillaTransform(LanternOn.getItemCameraTransforms().head); return Pair.of(LanternOn, null); default: return Pair.of(LanternOn, null); } } ModelBakeEvent Object LanternOn = event.modelRegistry.getObject(ModelLanternOn.modelLanternOn); if(LanternOn instanceof IBakedModel){ IBakedModel newLanternOn = (IBakedModel)LanternOn; ModelLanternOn customModel = new ModelLanternOn(newLanternOn); event.modelRegistry.putObject(ModelLanternOn.modelLanternOn, customModel); } Yes i dont combine models, because im doing additional rendering based on perspectives! But thats not the problem! So "RenderItem.applyVanillaTransform" does nothing! Thanks Lex! Quote
RainWarrior Posted November 8, 2015 Posted November 8, 2015 I assume the inner model for your lantern is a normal vanilla model - build 1529 fixed loading of perspective transformations for them, now they implement IPerspectiveAwareModel too, instead of relying on getItemCameraTransforms, so you need to use that. cast inner model to the IPerspectiveAwareModel, call handlePerspective, and return Pair.of(LanternOn, <second element of the result of inner model's handle perspective here>). Vanilla models should have correct value in getItemCameraTransforms again in the next build, when possible (not using Forge Blockstate Json). Quote
FLUFFY2 Posted November 8, 2015 Author Posted November 8, 2015 Well, my model has nothing to do with vanilla models. Its builded up with elements. Here is a snippet: { "__comment": "Designed by FLUFFY2", "textures": { "LanternTop": "amnesialights:models/LanternTop", "LanternOffSide": "amnesialights:models/LanternOffSide" }, "elements": [ { "__comment": "Lantern", "from": [ 5.25, 0, 6.5 ], "to": [ 10.25, 1.5, 9.5 ], "faces": { "down": { "uv": [ 10.75, 9.5, 5.75, 6.5 ], "texture": "#LanternTop", "cullface": "down" }, "up": { "uv": [ 5.25, 6.5, 10.25, 9.5 ], "texture": "#LanternTop" }, "north": { "uv": [ 5.75, 14.5, 10.75, 16 ], "texture": "#LanternOffSide" }, "south": { "uv": [ 5.25, 14.5, 10.25, 16 ], "texture": "#LanternOffSide" }, "west": { "uv": [ 6.5, 14.5, 9.5, 16 ], "texture": "#LanternOffSide" }, "east": { "uv": [ 6.5, 14.5, 9.5, 16 ], "texture": "#LanternOffSide" } } }, //Bunch more elements here ], "display": { "thirdperson": { "rotation": [ 180, -90, 30 ], "translation": [ 0, 3.6, 0.8 ], "scale": [ 0.8, 0.8, 0.8 ] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 0, -1, 0 ], "scale": [ 1.5, 1.5, 1.5 ] }, "fixed": { "rotation": [ 0, 90, 0 ], "translation": [ 0, 0, -0.2 ], "scale": [ 1.5, 1.5, 1.5 ] }, "firstperson": { "rotation": [ 0, -137, 0 ], "translation": [ -2.4, 0.1, -1.4 ], "scale": [ 2, 2, 2 ] }, "gui": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 1, 1, 1 ] } } } Quote
RainWarrior Posted November 8, 2015 Posted November 8, 2015 Nevertheless, please try build 1553 or later, it should fix your issue. In the future, try not to use getItemCameraTransforms, it can't always return the correct transformation. Quote
FLUFFY2 Posted November 8, 2015 Author Posted November 8, 2015 Thank you, it does fix the issue! Its not related here, but what changes happend to the lighting algorithm? Just because i have dynamic lighting and in 1.7.10 it dosent drop that much FPS, but in 1.8 it makes it unplayable. Optifin does fix this, but im just curious. Thanks again! Quote
Recommended Posts
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.