Posted October 1, 20204 yr So I've made an entity that has a part of the model that is a translucent cube, and now I'm trying to render an item from the entity within that translucent cube. I can see that the item is rendering, since it peeks out of the cube a bit, but I can't see the item through the translucent cube. I'm not that great with rendering since I've only recently begun modding Minecraft, so I need a bit of help figuring out how to get the item to be visible through the translucent cube. Here is what it looks like. Here is the renderer class that it uses. package me.bluemond.bluemagic.client.entity.renderer; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import me.bluemond.bluemagic.BlueMagic; import me.bluemond.bluemagic.client.entity.model.EmpowermentEntityModel; import me.bluemond.bluemagic.entities.EmpowermentEntity; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.model.EntityModel; import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.util.ResourceLocation; import software.bernie.geckolib.render.IModelRenderer; public class EmpowermentEntityRenderer extends EntityRenderer<EmpowermentEntity> implements IModelRenderer { protected static final ResourceLocation TEXTURE = new ResourceLocation(BlueMagic.MOD_ID, "textures/entity/empowerment_entity.png"); protected final EmpowermentEntityModel empowermentModel = new EmpowermentEntityModel(); public EmpowermentEntityRenderer(EntityRendererManager renderManager) { super(renderManager); this.shadowSize = 0.5f; } @Override public void render(EmpowermentEntity entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) { this.empowermentModel.setRotationAngles(entityIn, partialTicks, 0.0F, -0.1F, 0.0F, 0.0F); this.empowermentModel.setLivingAnimations(entityIn, 0, 0, partialTicks); IVertexBuilder iVertexBuilder = bufferIn.getBuffer(RenderType.getEntityTranslucent(this.getEntityTexture(entityIn))); this.empowermentModel.render(matrixStackIn, iVertexBuilder, packedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn); if(entityIn.getPotionStack() != null){ matrixStackIn.push(); matrixStackIn.translate(0, 1, 0); matrixStackIn.scale(0.5F, 0.5F, 0.5F); Minecraft.getInstance().getItemRenderer().renderItem(entityIn.getPotionStack(), ItemCameraTransforms.TransformType.FIXED, packedLightIn, OverlayTexture.NO_OVERLAY, matrixStackIn, bufferIn); matrixStackIn.pop(); } } @Override public ResourceLocation getEntityTexture(EmpowermentEntity entity){ return TEXTURE; } @Override public EntityModel getEntityModel() { return this.empowermentModel; } } Edited October 1, 20204 yr by BlueMond
October 1, 20204 yr Two things I suggest, reverse the order of rendering so that the item renders first and then the entity. Other thing is change the graphics to fabulous. I think only one of these will work. My theory though is that the item is being culled out from the ItemRenderer#renderItem as it uses a culling render layer. Since it's inside another block, it's being told that hey, you can't render here. So you'll probably need to make your own version that removes the culling feature from it rendering.
October 1, 20204 yr Author 8 hours ago, ChampionAsh5357 said: Two things I suggest, reverse the order of rendering so that the item renders first and then the entity. Other thing is change the graphics to fabulous. I think only one of these will work. My theory though is that the item is being culled out from the ItemRenderer#renderItem as it uses a culling render layer. Since it's inside another block, it's being told that hey, you can't render here. So you'll probably need to make your own version that removes the culling feature from it rendering. Alright, I'll look into it. EDIT: So I've looked into the item renderer and I dont see any special culling within the render function, but it does seem like whatever rendertype it is using for the buffer in the vertexbuilder could be affecting whether or not it is visible through the block. EDIT 2: Now that I think of it, I might benefit from using the EntityItemRenderer, rather than the ItemRenderer. Item Entities seem to be able to be seen from within translucent blocks, for example, water. EDIT 3: So I can't seem to find where and how an ItemEntity is rendered. Anyone know about that? Edited October 1, 20204 yr by BlueMond
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.