Jump to content

[1.7.10] Model rendering across multiple blocks


Titanium237458

Recommended Posts

Hey,

I'm made a model that uses up a 3x3x1 space, and it originates in the middle block, the master block which does all the work. Around it there are 8 blocks which only give the multiblock a bigger collision.

 

My problem now is that if you don't have the master block in the screen, the model vanishes, even though you still look at the blocks that gives the model a collision box.

 

As all the blocks have different meta data, as their collision box isn't the same, I could solve this by letting MC render parts of the model in all the blocks, bt that would require more TESR and with it more performance, which I try to avoid.

 

Here are some pictures that show the problem:

 

With the model:

 

Looking a bit more up:

 

 

And here's the model class:

public class ModelHopperBig extends ModelBase {
    public ModelRenderer Connector;
    public ModelRenderer Middle;
    public ModelRenderer Wall1;
    public ModelRenderer Wall2;
    public ModelRenderer Wall3;
    public ModelRenderer Wall4;
    public ModelRenderer InnerWall1;
    public ModelRenderer InnerWall2;
    public ModelRenderer InnerWall3;
    public ModelRenderer InnerWall4;

    public ModelHopperBig() {
        this.textureWidth = 256;
        this.textureHeight = 128;
        
        this.Connector = new ModelRenderer(this, 0, 0);
        this.Connector.setRotationPoint(-6.0F, 20.0F, -6.0F);
        this.Connector.addBox(0.0F, 0.0F, 0.0F, 12, 4, 12, 0.0F);
        
        this.Middle = new ModelRenderer(this, 0, 92);
        this.Middle.setRotationPoint(-16.0F, 17.0F, -16.0F);
        this.Middle.addBox(0.0F, 0.0F, 0.0F, 32, 3, 32, 0.0F);
        
        this.Wall1 = new ModelRenderer(this, 90, 11);
        this.Wall1.setRotationPoint(-24.0F, 10.0F, -24.0F);
        this.Wall1.addBox(0.0F, 0.0F, 0.0F, 48, 6, 2, 0.0F);
        
        this.Wall2 = new ModelRenderer(this, 90, 0);
        this.Wall2.setRotationPoint(-24.0F, 10.0F, 22.0F);
        this.Wall2.addBox(0.0F, 0.0F, 0.0F, 48, 6, 2, 0.0F);
        
        this.Wall3 = new ModelRenderer(this, 105, 65);
        this.Wall3.setRotationPoint(-24.0F, 10.0F, -22.0F);
        this.Wall3.addBox(0.0F, 0.0F, 0.0F, 2, 6, 44, 0.0F);
        
        this.Wall4 = new ModelRenderer(this, 160, 77);
        this.Wall4.setRotationPoint(22.0F, 10.0F, -22.0F);
        this.Wall4.addBox(0.0F, 0.0F, 0.0F, 2, 6, 44, 0.0F);
        
        this.InnerWall1 = new ModelRenderer(this, 90, 50);
        this.InnerWall1.setRotationPoint(-22.0F, 15.0F, 16.0F);
        this.InnerWall1.addBox(0.0F, 0.0F, 0.0F, 44, 3, 6, 0.0F);
        
        this.InnerWall2 = new ModelRenderer(this, 90, 30);
        this.InnerWall2.setRotationPoint(-22.0F, 15.0F, -22.0F);
        this.InnerWall2.addBox(0.0F, 0.0F, 0.0F, 44, 3, 6, 0.0F);
        
        this.InnerWall3 = new ModelRenderer(this, 0, 54);
        this.InnerWall3.setRotationPoint(-22.0F, 15.0F, -16.0F);
        this.InnerWall3.addBox(0.0F, 0.0F, 0.0F, 6, 3, 32, 0.0F);
        
        this.InnerWall4 = new ModelRenderer(this, 21, 10);
        this.InnerWall4.setRotationPoint(16.0F, 15.0F, -16.0F);
        this.InnerWall4.addBox(0.0F, 0.0F, 0.0F, 6, 3, 32, 0.0F);
    }

    @Override
    public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { 
        this.Connector.render(f5);
        this.Middle.render(f5);
        this.Wall1.render(f5);
        this.Wall2.render(f5);
        this.Wall3.render(f5);
        this.Wall4.render(f5);
        this.InnerWall1.render(f5);
        this.InnerWall2.render(f5);
        this.InnerWall3.render(f5);
        this.InnerWall4.render(f5);
    }
}

 

And the renderer class:

public class TileEntityHopperBigRender extends TileEntitySpecialRenderer {

ModelHopperBig model = new ModelHopperBig();


@Override
public void renderTileEntityAt(TileEntity tile, double d, double d1, double d2, float f) {
	GL11.glPushMatrix();
	GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
	GL11.glRotatef(180F, 0, 0, 1F);
	TileModHopper tileE = (TileModHopper) tile;
	render(tileE, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, ModBlocks.hopperEnder);
	GL11.glPopMatrix();
}

public void render(TileModHopper tl, World world, int i, int j, int k, Block block) {
	Tessellator tessellator = Tessellator.instance;
	float f = block.getLightValue();
	int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
	int l1 = l % 65536;
	int l2 = l / 65536;
	tessellator.setColorOpaque_F(f, f, f);
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) l1, (float) l2);
	GL11.glPushMatrix();
	GL11.glRotatef(0, 0F, 1F, 0F);
	bindTexture(new ResourceLocation(LibMisc.MODID, "textures/model/ModelHopperBig.png"));
	model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
	GL11.glPopMatrix();
}

}

 

I hope you can help me, I appreciate anything that can help me, thank you :)

Link to comment
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.
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



×
×
  • Create New...

Important Information

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