Posted May 15, 20205 yr I have a gun item that needs to have additional models like sights rendered on it. I got the ISTER to do "something", but I can't for the live of me figure out how to render the original item with its appropriate transforms. I specifically have two problems: There seems to be no way to get the ItemCameraTransforms.TransformType the renderer was called for The call to IBakedModel::handlePerspective seems to have no influence This is my render code: public class RenderGun extends ItemStackTileEntityRenderer { private EnumGun gun; private IBakedModel gunModel; private Random rand = new Random(); private IModelData data = new ModelDataMap.Builder().build(); public RenderGun() { } @Override public void render(ItemStack stack, MatrixStack mstack, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) { if (gun == null && stack.getItem() instanceof ItemGun) { gun = ((ItemGun)stack.getItem()).getGun(); } if (gun != null && gunModel == null) { gunModel = getGunModel(gun); } IVertexBuilder builder = buffer.getBuffer(RenderType.getCutoutMipped()); if (gunModel != null) { //noinspection deprecation gunModel.handlePerspective(ItemCameraTransforms.TransformType.FIXED, mstack); for (BakedQuad quad : gunModel.getQuads(null, null, rand, data)) { builder.addQuad(mstack.getLast(), quad, 1.0F, 1.0F, 1.0F, combinedLight, combinedOverlay); } } } }
May 16, 20205 yr I dug a little deeper into this and found a rather convoluted (in my opinion) way to fix this. The only way to get the ItemCameraTransform.TransformType the renderer was called with seems to be to save it in your custom IBakedModel implementation (which you need anyway for ISTERs to work at all) in IBakedModel::handlePerspective which gets called from the item renderer before calling your ISTER. This also makes the call to IBakedModel::handlePerspective in the ISTER obsolete. Now that that works I have the problem that the models that are rendered do not have any shading whatsoever.
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.