Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

So i am custom rendering my block using a tesslator. How would i do that in the inventory?

Here is my code:

My itemrenderer:

 

 

package com.professorvennie.main.Itemrender;

import com.professorvennie.main.render.TileEntityRenderWasher;

import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;

public class ItemRenderWasher implements IItemRenderer{

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	return true;
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
	return true;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	new TileEntityRenderWasher();
}

}

 

 

My custom renderer:

 

 

package com.professorvennie.main.render;

import org.lwjgl.opengl.GL11;

import com.professorvennie.block.EFBlock;
import com.professorvennie.lib.Strings;

import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

public class TileEntityRenderWasher extends TileEntitySpecialRenderer{

private final ResourceLocation texterwasher = new ResourceLocation(Strings.MODID, "textures/blocks/ironoxideblock.png");
private final ResourceLocation glass = new ResourceLocation( "textures/blocks/glass.png");
private float pixel = 1F/16F;
private int textureWidth = 32;
private int textureHeight = 32;

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y,double z, float var8) {
	int x1 = tileentity.xCoord;
	int y1 = tileentity.yCoord;
	int z1 = tileentity.zCoord;

	int metadata =tileentity.getWorldObj().getBlockMetadata(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);

	GL11.glPushMatrix();
	GL11.glDisable(GL11.GL_LIGHTING);
		GL11.glTranslatef((float)x, (float)y, (float)z);	



		Tessellator tessellator = Tessellator.instance;
		this.bindTexture(texterwasher);
		tessellator.startDrawingQuads();

		if(metadata == 5){
			this.bindTexture(glass);
			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(1, 1, 1, 1, 0);
			tessellator.addVertexWithUV(0, 1, 1, 0, 0);
			tessellator.addVertexWithUV(0, 0, 1, 0, 1);

			tessellator.addVertexWithUV(1, 1, 0, 1, 0);
			tessellator.addVertexWithUV(1, 0, 0, 1, 1);
			tessellator.addVertexWithUV(0, 0, 0, 0, 1);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);


		}
		if(metadata == 7){
			this.bindTexture(glass);

			tessellator.addVertexWithUV(1, 1, 1, 1, 0);
			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(1, 0, 0, 0, 1);
			tessellator.addVertexWithUV(1, 1, 0, 0, 0);

			tessellator.addVertexWithUV(0, 0, 1, 1, 1);
			tessellator.addVertexWithUV(0, 1, 1, 1, 0);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);
			tessellator.addVertexWithUV(0, 0, 0, 0, 1);

		}
		if(metadata == 6){
			this.bindTexture(texterwasher);
			tessellator.addVertexWithUV(1, 1, 1, 1, 0);
			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(1, 0, 0, 0, 1);
			tessellator.addVertexWithUV(1, 1, 0, 0, 0);

			tessellator.addVertexWithUV(0, 0, 1, 1, 1);
			tessellator.addVertexWithUV(0, 1, 1, 1, 0);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);
			tessellator.addVertexWithUV(0, 0, 0, 0, 1);

			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(1, 1, 1, 1, 0);
			tessellator.addVertexWithUV(0, 1, 1, 0, 0);
			tessellator.addVertexWithUV(0, 0, 1, 0, 1);

			tessellator.addVertexWithUV(1, 1, 0, 1, 0);
			tessellator.addVertexWithUV(1, 0, 0, 1, 1);
			tessellator.addVertexWithUV(0, 0, 0, 0, 1);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);

			tessellator.addVertexWithUV(0, 1, 1, 1, 0);
			tessellator.addVertexWithUV(1, 1, 1, 1, 1);
			tessellator.addVertexWithUV(1, 1, 0, 0, 1);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);

			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(0, 0, 1, 1, 0);
			tessellator.addVertexWithUV(0, 0, 0, 0, 0);
			tessellator.addVertexWithUV(1, 0, 0, 0, 1);
		}
		if(metadata == 3){
			this.bindTexture(texterwasher);
			tessellator.addVertexWithUV(1, 1, 1, 1, 0);
			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(1, 0, 0, 0, 1);
			tessellator.addVertexWithUV(1, 1, 0, 0, 0);

			tessellator.addVertexWithUV(0, 0, 1, 1, 1);
			tessellator.addVertexWithUV(0, 1, 1, 1, 0);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);
			tessellator.addVertexWithUV(0, 0, 0, 0, 1);

			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(1, 1, 1, 1, 0);
			tessellator.addVertexWithUV(0, 1, 1, 0, 0);
			tessellator.addVertexWithUV(0, 0, 1, 0, 1);

			tessellator.addVertexWithUV(1, 1, 0, 1, 0);
			tessellator.addVertexWithUV(1, 0, 0, 1, 1);
			tessellator.addVertexWithUV(0, 0, 0, 0, 1);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);


		}
		if(metadata == 2){
			this.bindTexture(texterwasher);
			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(0, 0, 1, 1, 0);
			tessellator.addVertexWithUV(0, 0, 0, 0, 0);
			tessellator.addVertexWithUV(1, 0, 0, 0, 1);

			tessellator.addVertexWithUV(0, 1, 1, 1, 0);
			tessellator.addVertexWithUV(1, 1, 1, 1, 1);
			tessellator.addVertexWithUV(1, 1, 0, 0, 1);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);

		}

		if(metadata == 4){
			this.bindTexture(texterwasher);
			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(0, 0, 1, 1, 0);
			tessellator.addVertexWithUV(0, 0, 0, 0, 0);
			tessellator.addVertexWithUV(1, 0, 0, 0, 1);

			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(1, 1, 1, 1, 0);
			tessellator.addVertexWithUV(0, 1, 1, 0, 0);
			tessellator.addVertexWithUV(0, 0, 1, 0, 1);

			tessellator.addVertexWithUV(1, 1, 0, 1, 0);
			tessellator.addVertexWithUV(1, 0, 0, 1, 1);
			tessellator.addVertexWithUV(0, 0, 0, 0, 1);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);

			tessellator.addVertexWithUV(0, 1, 1, 1, 0);
			tessellator.addVertexWithUV(1, 1, 1, 1, 1);
			tessellator.addVertexWithUV(1, 1, 0, 0, 1);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);
		}
		if(metadata == 1){
			this.bindTexture(texterwasher);
			tessellator.addVertexWithUV(1, 1, 1, 1, 0);
			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(1, 0, 0, 0, 1);
			tessellator.addVertexWithUV(1, 1, 0, 0, 0);

			tessellator.addVertexWithUV(0, 0, 1, 1, 1);
			tessellator.addVertexWithUV(0, 1, 1, 1, 0);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);
			tessellator.addVertexWithUV(0, 0, 0, 0, 1);

			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(1, 1, 1, 1, 0);
			tessellator.addVertexWithUV(0, 1, 1, 0, 0);
			tessellator.addVertexWithUV(0, 0, 1, 0, 1);

			tessellator.addVertexWithUV(1, 1, 0, 1, 0);
			tessellator.addVertexWithUV(1, 0, 0, 1, 1);
			tessellator.addVertexWithUV(0, 0, 0, 0, 1);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);

			tessellator.addVertexWithUV(0, 1, 1, 1, 0);
			tessellator.addVertexWithUV(1, 1, 1, 1, 1);
			tessellator.addVertexWithUV(1, 1, 0, 0, 1);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);

			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(0, 0, 1, 1, 0);
			tessellator.addVertexWithUV(0, 0, 0, 0, 0);
			tessellator.addVertexWithUV(1, 0, 0, 0, 1);
		}
	if(metadata == 0){
			this.bindTexture(texterwasher);
			tessellator.addVertexWithUV(1, 1, 1, 1, 0);
			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(1, 0, 0, 0, 1);
			tessellator.addVertexWithUV(1, 1, 0, 0, 0);

			tessellator.addVertexWithUV(0, 0, 1, 1, 1);
			tessellator.addVertexWithUV(0, 1, 1, 1, 0);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);
			tessellator.addVertexWithUV(0, 0, 0, 0, 1);

			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(1, 1, 1, 1, 0);
			tessellator.addVertexWithUV(0, 1, 1, 0, 0);
			tessellator.addVertexWithUV(0, 0, 1, 0, 1);

			tessellator.addVertexWithUV(1, 1, 0, 1, 0);
			tessellator.addVertexWithUV(1, 0, 0, 1, 1);
			tessellator.addVertexWithUV(0, 0, 0, 0, 1);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);

			tessellator.addVertexWithUV(1, 0, 1, 1, 1);
			tessellator.addVertexWithUV(0, 0, 1, 1, 0);
			tessellator.addVertexWithUV(0, 0, 0, 0, 0);
			tessellator.addVertexWithUV(1, 0, 0, 0, 1);

			tessellator.addVertexWithUV(0, 1, 1, 1, 0);
			tessellator.addVertexWithUV(1, 1, 1, 1, 1);
			tessellator.addVertexWithUV(1, 1, 0, 0, 1);
			tessellator.addVertexWithUV(0, 1, 0, 0, 0);

	}
	if(metadata == {
		this.bindTexture(texterwasher);
		tessellator.addVertexWithUV(0, 1, 1, 1, 0);
		tessellator.addVertexWithUV(1, 1, 1, 1, 1);
		tessellator.addVertexWithUV(1, 1, 0, 0, 1);
		tessellator.addVertexWithUV(0, 1, 0, 0, 0);
	}
		tessellator.draw();		
		GL11.glEnable(GL11.GL_LIGHTING);
	GL11.glPopMatrix();
}

}

 

 

 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.