Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Tell a block to render again?
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 0
gummby8

Tell a block to render again?

By gummby8, March 20, 2016 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
Posted March 20, 2016

I am messing around with the tintindex in model files. and now I can change the colors of one of my blocks without the need for thousands of different textures.

 

The problem is when I change the block color random amounts of the blocks change color, only when a block next to them changes.

 

@Override
    @SideOnly(Side.CLIENT)
    public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
    {
    	System.out.println("SOMETHING SOMETHING");
        return getBlockColor();
    }

 

the blockColor changes once every second. only the blocks do nothing till I place a block near it. Is there a way to can tell teh block to update every second after I change the blockColor?

 

Thank you,

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2092

Draco18s

Draco18s    2092

  • Reality Controller
  • Draco18s
  • Members
  • 2092
  • 14021 posts
Posted March 20, 2016

You shouldn't be using standard block models for this.  What you're seeing is that every chunk has a single mesh that gets computed once and rendered until it changes.

 

Which means that simply changing the color multiplier won't be respected until the chunk rerenders for some other reason.

 

You would need to have your block cause a block update when it changes color, which will rerender the whole chunk.  Yikes!  You should use a TileEntity.

  • Quote

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
Posted March 20, 2016

you mean a custom tile entity renderer?

 

Damn, I was dinking around with these for a bit when I saw the a thread about tintindex, was hoping it would save me from having to make another renderer.

  • Quote

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
Posted March 20, 2016

Well I get 3/4 of the way there.

 

I can see the tile entity rendered. 2 problems

 

1 the texture is flickering over the normal block texture. Like the block and the tile entity are trying to render at the same time.

 

2 the tile entity is rendering as a flat single surface. not just a normal 16x16x16 cube

 

140c5w.png

 

@Override
    public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f, int number){
    	System.out.println("derp?");
        ResourceLocation image = new ResourceLocation("mb:textures/blocks/portal_block.png");
        this.bindTexture(image);
        Tessellator tessellator = Tessellator.getInstance();
        GL11.glPushMatrix();
        GL11.glTranslated(x, y , z);
        tessellator.getWorldRenderer().startDrawingQuads();
        tessellator.getWorldRenderer().addVertexWithUV(0, 0, 0, 0, 0);
        tessellator.getWorldRenderer().addVertexWithUV(0, 1, 0, 0, 1);
        tessellator.getWorldRenderer().addVertexWithUV(1, 1, 0, 1, 1);
        tessellator.getWorldRenderer().addVertexWithUV(1, 0, 0, 1, 0);

        tessellator.getWorldRenderer().addVertexWithUV(0, 0, 0, 0, 0);
        tessellator.getWorldRenderer().addVertexWithUV(1, 0, 0, 1, 0);
        tessellator.getWorldRenderer().addVertexWithUV(1, 1, 0, 1, 1);
        tessellator.getWorldRenderer().addVertexWithUV(0, 1, 0, 0, 1);
        tessellator.draw();
        
        
        
        GL11.glPopMatrix();
    }

 

I have tried looking through the minecraft code to find stuff with addVertxWithUV and I am not getting anything. It should not be this difficult to render a cube :(

  • Quote

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
Posted March 20, 2016

Ok fixed the quad drawing issue, but the tile entity is still phasing in and out of the cube, even if I give the cube a transparent texture there is still a white background to it.

 

2mfzsl4.png

  • Quote

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
Posted March 20, 2016

Ok Fixed hat problem with this

 

  GL11.glTranslated(x - 0.005f, y - 0.005f , z - 0.005f);
  GL11.glScalef(1.01f, 1.01f, 1.01f);

 

 

Last problem

 

The tile entity serves as a teleporter. It randomly selects a position from a list every 60 seconds

 

Server side, the tile entity rolls random from 0 - 255 for the RGB colors for the renderer every 60 seconds. This correlates to when the tile entity switches teleport locations. So the players know, if they want their party to stick together, wait for the tile entity to change colors, they proceed into the portal all at once.

 

Problem is, the server is rolling to color code, and the client needs it. Do I need to make a custom packet for this or is there an easy way to sync 1 integer from the server tileEntity to the clients tileEntity without the need for a custom packet?

  • Quote

Share this post


Link to post
Share on other sites

Elix_x    75

Elix_x

Elix_x    75

  • Dragon Slayer
  • Elix_x
  • Members
  • 75
  • 878 posts
Posted March 20, 2016

Problem is, the server is rolling to color code, and the client needs it. Do I need to make a custom packet for this or is there an easy way to sync 1 integer from the server tileEntity to the clients tileEntity without the need for a custom packet?

[lmgtfy]minecraft forge tile entity synchronization[/lmgtfy]

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2092

Draco18s

Draco18s    2092

  • Reality Controller
  • Draco18s
  • Members
  • 2092
  • 14021 posts
Posted March 20, 2016

The z-fighting was because you didn't set the block to rendermode -1.  So it was rendering itself, then the TE was rendering on top of it afterward.

 

The scale only makes the z-fighting go away because now the TE is 1% larger.

  • Quote

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
Posted March 20, 2016

Problem is, the server is rolling to color code, and the client needs it. Do I need to make a custom packet for this or is there an easy way to sync 1 integer from the server tileEntity to the clients tileEntity without the need for a custom packet?

[lmgtfy]minecraft forge tile entity synchronization[/lmgtfy]

 

 

/sigh first page was what I needed.

 

what is upsetting is I looked right at that page and didn't do anything with it....admittedly I was drunk >.<

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2092

Draco18s

Draco18s    2092

  • Reality Controller
  • Draco18s
  • Members
  • 2092
  • 14021 posts
Posted March 20, 2016

width=652 height=592https://imgs.xkcd.com/comics/ballmer_peak.png[/img]

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • DaemonUmbra
      [solved]

      By DaemonUmbra · Posted 7 minutes ago

      For future reference: 1.7.10 is no longer supported on this forum due to its age. Update to a modern version of Minecraft to receive support.
    • OdachiPlayz
      [solved]

      By OdachiPlayz · Posted 23 minutes ago

      I DONT KNOW HOW TO DELETE THIS POST BUT IM DUMB AND SOLVED THE ISSUE MYSELF ADMINS PLEASE DELETE  
    • KingMax
      Endsieg WW2 - Server due to start very soon - Working guns and vehicles!

      By KingMax · Posted 54 minutes ago

      Greetings Comrade/Captain/Hauptmann! Welcome to Europe's final theater of war, Scandinavia! Despite the fall of Berlin the third Reich continues to hold out in Norway and the surrounding areas, the war is not yet over. Ultimate Victory will require many more battles to be fought. Infrastructure will need to be built, tanks, planes and ships shall have to be designed and produced and factories will be needed to produce the weapons of war.Endsieg has a multitude of special mechanics found on almost no other MC servers: fully functional ground, air and sea vehicles, guns, factories and more!Will you fight for the Allies to liberate Norway from tyranny?Will you defend the Soviet motherland by finally defeating the fascist menace?Will you take up the mantle of saving the remains of the Third Reich?Will you preserve the territorial integrity of the Republic of Finland?Will you help the Kingdom of Sweden once again rise to prominence as a Baltic powerhouse?Due to launch in a short matter of days or weeks, join our discord!discord.gg/anp3BJQ
    • Crack3dC0d3
      [1.14.4] Multiple models on the same item.

      By Crack3dC0d3 · Posted 1 hour ago

      bump
    • snivinia
      unable to connect to friend's modded server

      By snivinia · Posted 2 hours ago

      my mistake, these should be the right links now https://drive.google.com/file/d/1CxPl-CVNCtOl0LWKv9U7o9WT6jBtMOe1/view?usp=sharing https://drive.google.com/file/d/11YJ-SAt7nYmloZQXOw5f4-gsxpYtDMyN/view?usp=sharing will also update in original post
  • Topics

    • OdachiPlayz
      1
      [solved]

      By OdachiPlayz
      Started 23 minutes ago

    • KingMax
      0
      Endsieg WW2 - Server due to start very soon - Working guns and vehicles!

      By KingMax
      Started 53 minutes ago

    • Crack3dC0d3
      4
      [1.14.4] Multiple models on the same item.

      By Crack3dC0d3
      Started December 2

    • snivinia
      2
      unable to connect to friend's modded server

      By snivinia
      Started 19 hours ago

    • DragonITA
      12
      [1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?

      By DragonITA
      Started 14 hours ago

  • Who's Online (See full list)

    • Kuruchov
    • SE103
    • DaemonUmbra
    • DavidM
    • OdachiPlayz
    • plugsmustard
    • Hendoor64
    • JMAS
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Tell a block to render again?
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community