Jump to content

Recommended Posts

Posted

Hi,

 

I'm currently having some problems with my render code for my block. I'm using Minecraft Forge 1.8.9.

The renderer draws sometimes blocks like the water in a different colour when I'm coming near to my own block and moving there a bit around.

 

Here is a picture of the problem:

WQv3pMd.png

 

And a picture which shows how everything is rendered when I'm a bit farer away. (just moved a bit away from my block)

gyUCKh1.png

 

The next point would be, when you are about 20 blocks from my block away it turns invisible, same goes when you are over the block (directly over it or farer away).

It does not turn complete invisible at once, it's goes more that part of part of the block are turning invisible.

 

Here is my TileEntityPortalRenderer:

@SideOnly(Side.CLIENT)
public class TileEntityPortalRenderer extends TileEntitySpecialRenderer<TileEntityPortal> {
    
    public static int sphereIDOutside;
    public static int sphereIDInside;
    
    @Override
    public void renderTileEntityAt(TileEntityPortal tileEntity, double posX, double posY, double posZ, float partialTicks, int destroyStage) {
        GlStateManager.pushMatrix(); // store the transformation 
        GlStateManager.translate(posX, posY, posZ); // set viewport to tile entity position to render it
        
        /* ============ Rendering Code goes here ============ */
        
        GlStateManager.translate(posX + 1f, posY - .6f, posZ + 1f);
        GlStateManager.enableBlend(); // enable rendering for transparency
        GlStateManager.depthMask(false);
        GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GlStateManager.color(1.f, 1.f, 1.f, 1.f);
        GlStateManager.callList(TileEntityPortalRenderer.sphereIDOutside);
        GlStateManager.callList(TileEntityPortalRenderer.sphereIDInside);
        
        //renderLight(posX, posY, posZ);
        GlStateManager.resetColor();
        GlStateManager.disableBlend();
        
        /* ============ Rendering Code stops here =========== */
        
        GlStateManager.popMatrix(); // restore the transformation, so other renderer's are not messed up
    }
    
    public static void createSphere() {
        Sphere sphere = new Sphere();
        sphere.setDrawStyle(GLU.GLU_FILL); // fill as a solid
        sphere.setTextureFlag(true);
        sphere.setNormals(GLU.GLU_SMOOTH); // smooth everything
        
        // First make the call list for the outside of the sphere
        sphere.setOrientation(GLU.GLU_OUTSIDE);
        TileEntityPortalRenderer.sphereIDOutside = GL11.glGenLists(1);
        // Create a new list to hold our sphere data
        GL11.glNewList(TileEntityPortalRenderer.sphereIDOutside, GL11.GL_COMPILE);
        // binds the texture
        ResourceLocation resource = new ResourceLocation(Constants.MOD_ID + ":" + "textures/entities/sphere.png");
        Minecraft.getMinecraft().getTextureManager().bindTexture(resource);
       
        sphere.draw(1.2f, 32, 32);
        GL11.glEndList();
        
        // Make the call list for the inside of the sphere
        sphere.setOrientation(GLU.GLU_INSIDE);
        TileEntityPortalRenderer.sphereIDInside = GL11.glGenLists(1);
        // Create a new list to hold our sphere data
        GL11.glNewList(TileEntityPortalRenderer.sphereIDInside, GLU.GLU_INSIDE);
        Minecraft.getMinecraft().getTextureManager().bindTexture(resource);
        
        sphere.draw(1.2f, 32, 32);
        GL11.glEndList();
    }
}

 

My init method in the ClientProxy which get's called at the end of the init method in the main class:

    @Override
    public void init() {
        super.init();
        
        TileEntityPortalRenderer.createSphere();
    }

 

Here are my json files:

blockstates

{
    "variants": {
        "normal": { "model": "primevalforest:portal" }
    }
}

 

block

{
"parent": "block/generated",
"textures": {
	"cross": "primevalforest:blocks/portal"
}
}

 

item

{
    "parent": "builtin/generated",
    "textures": {
        "layer0": "primevalforest:blocks/portal"
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0 ],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55 ]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.7, 1.7, 1.7 ]
        }
    }
}

 

I hope someone can help me. ;)

 

Thx in advance.

Bektor

Developer of Primeval Forest.

Posted
  On 4/12/2016 at 5:28 PM, DestinySpork said:

Use an OBJ model both of these problems will be solved.

Unless you need it to do special stuff.

I might be using obj's in the future, but this problem got my interest and I want to know what's wrong there at any price. ^^

Why do I want to fix this problem at any cost: because of all the OpenGL error's I'm getting and to fix them might help me also

to better understand what's going on and how to fix it if I might get such errors outside of Minecraft, too.

 

So I tracked down the issue yet a bit:

 

// Make the call list for the inside of the sphere
        sphere.setOrientation(GLU.GLU_INSIDE);
        TileEntityPortalRenderer.sphereIDInside = GL11.glGenLists(1);
        // Create a new list to hold our sphere data
        GL11.glNewList(TileEntityPortalRenderer.sphereIDInside, GLU.GLU_INSIDE);
        Minecraft.getMinecraft().getTextureManager().bindTexture(resource);
        
        sphere.draw(1.2f, 32, 32);
        GL11.glEndList();

So, as seen above, removing this lines of code for the inner sphere removes the issue:

[Client thread/ERROR]: @ Post render

[Client thread/ERROR]: 1280: Invalid enum

[Client thread/ERROR]: ########## GL ERROR ##########

 

Now I've got only this code left in the createSphere method. I also removed the GlStateManager.color and GlStateManager.resetColor calls in renderTileEntityAt.

    public static void createSphere() {
        Sphere sphere = new Sphere();
        sphere.setDrawStyle(GLU.GLU_FILL); // fill as a solid
        sphere.setTextureFlag(true);
        sphere.setNormals(GLU.GLU_SMOOTH); // smooth everything
        
        // First make the call list for the outside of the sphere
        sphere.setOrientation(GLU.GLU_OUTSIDE);
        TileEntityPortalRenderer.sphereIDOutside = GL11.glGenLists(1);
        // Create a new list to hold our sphere data
        GL11.glNewList(TileEntityPortalRenderer.sphereIDOutside, GL11.GL_COMPILE);
        // binds the texture
        ResourceLocation resource = new ResourceLocation(Constants.MOD_ID + ":" + "textures/entities/sphere.png");
        Minecraft.getMinecraft().getTextureManager().bindTexture(resource);
       
        sphere.draw(1.2f, 32, 32);
        GL11.glEndList();
}

 

So now I'm getting a new error. This error does not happen on start up, it happens only when the block is drawn:

[Client thread/ERROR]: ########## GL ERROR ##########

[Client thread/ERROR]: @ Post render

[Client thread/ERROR]: 1281: Invalid value

 

So something I did or a class I'm using for it is heavily broken. Any ideas what the error could be?

 

Thx in advance.

Bektor

Developer of Primeval Forest.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • wait, i just did that. why didn't it work? also it's the same. help me!!!!
    • Culprit has been located! It was Tough As Nails + (plus) which was among one of the mods *added* before re-entering, in an attempt to improve compatibility. It, for some reason or another, did not want to work!
    • "You can either try to load it with only the vanilla data pack ("safe mode"), or go back to the title screen and fix it manually." Hello! I encountered this error just now while attempting to re-enter my world for the first time. Notably, no mods were removed before encountering this error and, while being able to find this error elsewhere on the internet, in my scenario it is seemingly caused by a specific mod, of which I cannot isolate. Things I have tried: - Enter "Safe Mode" (fails) - Remove datapacks (no change) - Reverted to old save data (no change) Here is the server log: https://mclo.gs/9vJQEfN I use Modrinth mod loader so please let me know how to share my mod list, and if it is needed.
    • So, i'm hosting (or attempting to host) a port-forwarded modded server for 1.12.2. There's quite a few mods in this pack, but they all run and have no compatibility issues (besides something causing the game to crash if you go fullscreen, a problem ive given up trying to identify or fix). It can run on 6gb of ram or less, and works fine in singleplayer. All of my friends that want to join have the exact same mod/config/game setup as I do (I personally helped them set everything up). Just to be safe, we've all allocated 12 gigabytes of RAM to the installation, and I've also allocated 12GB to the server itself. I am able to join with no issue and it runs fine. However, when they try to join, it gets stuck in the 'logging in' screen before their game becomes unresponsive. When they close it, it gives them the exit code 805306369, which usually means not enough RAM, but this cant be the case. On my screen, in the server, it shows them joining, and then disconnecting, so I dont think its a port-forwarding issue. They can all run it just fine in singleplayer as well. The annoying bit about this particular issue is that it generates no crash log. Does anyone have any suggestions? Thanks! Here is my debug log, and his, starting from the same place. MINE: [132647] [Netty Client IO #5INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132653.817 [132653] [Client threadINFO] [minecraftGuiConnecting] Connecting to 0, 25565 132654.682 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.common.core.transformer.ClassNodeTransformertransform29] Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 132654.684 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.map.core.transformer.ClassNodeTransformertransform29] Transforming class net.minecraft.client.network.NetHandlerPlayClient 132654.764 [132654] [Netty Client IO #9INFO] [FML] Server protocol version 2 132654.777 [132654] [Netty Client IO #9INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132656.193 [132656] [Client threadINFO] [FML] Injecting existing registry data into this client instance 132659.081 [132659] [Client threadINFO] [FML] Applying holder lookups 132659.082 [132659] [Client threadINFO] [FML] Holder lookups applied 132659.092 [132659] [Netty Client IO #9INFO] [FML] [Netty Client IO #9] Client side modded connection established HIS: [13:12:16] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:25.597 [13:12:25] [Client thread/INFO] [minecraft/GuiConnecting]: Connecting to (my IP address and the server port 25565) 13:12:26.805 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.common.core.transformer.ClassNodeTransformer:transform:29]: Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 13:12:26.808 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.map.core.transformer.ClassNodeTransformer:transform:29]: Transforming class net.minecraft.client.network.NetHandlerPlayClient 13:12:26.936 [13:12:26] [Netty Client IO #1/INFO] [FML]: Server protocol version 2 13:12:27.114 [13:12:27] [Netty Client IO #1/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:27.480 [13:12:27] [Client thread/INFO] [FML]: Injecting existing registry data into this client instance 13:12:30.669 [13:12:30] [Client thread/INFO] [FML]: Applying holder lookups 13:12:30.671 [13:12:30] [Client thread/INFO] [FML]: Holder lookups applied 13:13:04.700 Process crashed with exit code -805306369 P.S - Both mods "CTM" and "FUSION" are present in both our folders so idk what that's about.
    • Please read the FAQ (link is orange banner at top of page), and post logs as described there, to an external site such as https://mclo.gs  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.