我迷失了为什么当我从南方或东方看时我的纹理会按预期渲染,但从北方或西方看时隐藏在它们后面的对象。
我有一个不可见的块,它在其中呈现多个项目,并且在使用具有半透明纹理的块时遇到问题。已尝试切换基础块和纹理块的所有块属性(例如渲染类型、图层、不透明),并尝试在渲染上使用不同的混合选项。
锻造版本 1.12
public class BlueRenderer extends TileEntitySpecialRenderer<TileEntityBlue> {
@Override
public void render(TileEntityBlue tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
itemRenderer = mc.getRenderItem();
textureManager = mc.getTextureManager();
blockModelShapes = mc.getBlockRendererDispatcher().getBlockModelShapes();
GlStateManager.pushAttrib();
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
GlStateManager.disableRescaleNormal();
renderItem(new GetBlock("minecraft:jukebox"), 0.5F);
renderItem(new GetBlock("mymod:blue"), 1F);
GlStateManager.popMatrix();
GlStateManager.popAttrib();
}
private void renderItem(GetBlock block, float scale) {
RenderHelper.enableStandardItemLighting();
GlStateManager.enableLighting();
GlStateManager.pushMatrix();
GlStateManager.translate(0.5, 0.5, 0.5);
GlStateManager.scale(scale, scale, scale);
IBakedModel model = blockModelShapes.getModelForState(block.state);
model = ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.NONE, false);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
itemRenderer.renderItem(block.stack, model);
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}