• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hey everyone, I'm currently trying to build a custom portal block and everything is working nicely so far, however I've run into a weird issue with the portal animation (the one that plays out when standing inside the portal): Just like the vanilla game I call a function that renders the portal animation, I call it from a RenderGameOverlayEvent (which should be the correct event) and the timeInPortal value also is computed correctly (I checked to make sure, it changes as intended and is calculated the same way the vanilla portal calculates it). As far as I understand the code this value controls the alpha value of the texture, however it is always rendered with no transparency at all, even if I substitute timeInPortal with 0 and I'm not sure why. I'm assuming either the blend mode is wrong (which is unlikely, as I copied the code from the vanilla class) or I load my texture wrong/without alpha for some reason. Any pointers? (Yes, the block is set up to have translucency and as a block in the world it renders correctly, but not as an overlay texture for some reason) The render code (apart from grabbing a Minecraft Instance named mc this is exactly how vanilla does it aswell): public static void renderPortalAnim(float timeInPortal, int scaledWidth, int scaledHeight) { if (timeInPortal < 1.0F) { timeInPortal = timeInPortal * timeInPortal; timeInPortal = timeInPortal * timeInPortal; timeInPortal = timeInPortal * 0.8F + 0.2F; } Minecraft mc = Minecraft.getInstance(); RenderSystem.disableAlphaTest(); RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.defaultBlendFunc(); RenderSystem.color4f(1.0F, 1.0F, 1.0F, timeInPortal); mc.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); TextureAtlasSprite textureatlassprite = mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(BlockInit.custom_portal.getDefaultState()); float f = textureatlassprite.getMinU(); float f1 = textureatlassprite.getMinV(); float f2 = textureatlassprite.getMaxU(); float f3 = textureatlassprite.getMaxV(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.func_225582_a_(0.0D, (double)scaledHeight, -90.0D).func_225583_a_(f, f3).endVertex(); bufferbuilder.func_225582_a_((double)scaledWidth, (double)scaledHeight, -90.0D).func_225583_a_(f2, f3).endVertex(); bufferbuilder.func_225582_a_((double)scaledWidth, 0.0D, -90.0D).func_225583_a_(f2, f1).endVertex(); bufferbuilder.func_225582_a_(0.0D, 0.0D, -90.0D).func_225583_a_(f, f1).endVertex(); tessellator.draw(); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); RenderSystem.enableAlphaTest(); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); }  
    • 1. That is literally an empty method (i.e. it does nothing). 2. If you did anything in your implementation of it, just call your own method instead of openInventory.
    • Please clarify "it don't do anything". Post logs.
    • Wrong thread. This is for modders not for players.
  • Topics

  • Who's Online (See full list)