Posted August 9, 201411 yr Im fairly new to modding but im trying to use a model for a tile entity but i used this code but it wont work here is where i got it from http://www.minecraftforge.net/wiki/Rendering_a_Techne_Model_as_a_Block Here is my code Block Class: package me.trolltaylor; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class BlockTileEntity extends BlockContainer { public BlockTileEntity (Material material) { super(material); } //You don't want the normal render type, or it wont render properly. @Override public int getRenderType() { return -1; } //It's not an opaque cube, so you need this. @Override public boolean isOpaqueCube() { return false; } //It's not a normal block, so you need this too. public boolean renderAsNormalBlock() { return false; } @Override public TileEntity createNewTileEntity(World arg0, int arg1) { // TODO Auto-generated method stub return new TileEntityTank(); } } TileEntity: package me.trolltaylor; import net.minecraft.tileentity.TileEntity; public class TileEntityE extends TileEntity{ } TileEntityRenderer: package me.trolltaylor.liquid.management.model; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; public class TileEntityERenderer extends TileEntitySpecialRenderer { //The model of your block private final TileEntityModel model; public TileEntityERenderer() { this.model = new TileEntityModel(); } private void adjustRotatePivotViaMeta(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); GL11.glPushMatrix(); GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F); GL11.glPopMatrix(); } @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) { //The PushMatrix tells the renderer to "start" doing something. GL11.glPushMatrix(); //This is setting the initial location. GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); //This is the texture of your block. It's pathed to be the same place as your other blocks here. //Outdated bindTextureByName("/mods/roads/textures/blocks/TrafficLightPoleRed.png"); //Use in 1.6.2 this ResourceLocation textures = (new ResourceLocation("lq:textures/blocks/New.png")); //the ':' is very important //binding the textures Minecraft.getMinecraft().renderEngine.bindTexture(textures); //This rotation part is very important! Without it, your model will render upside-down! And for some reason you DO need PushMatrix again! GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); //A reference to your Model file. Again, very important. this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); //Tell it to stop rendering for both the PushMatrix's GL11.glPopMatrix(); GL11.glPopMatrix(); } //Set the lighting stuff, so it changes it's brightness properly. private void adjustLightFixture(World world, int i, int j, int k, Block block) { Tessellator tess = Tessellator.instance; //float brightness = block.getBlockBrightness(world, i, j, k); //As of MC 1.7+ block.getBlockBrightness() has become block.getLightValue(): float brightness = block.getLightValue(world, i, j, k); int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0); int modulousModifier = skyLight % 65536; int divModifier = skyLight / 65536; tess.setColorOpaque_F(brightness, brightness, brightness); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier); } } My Registers and stuff : GameRegistry.registerTileEntity(me.trolltaylor.TileEntityE.class, "tileentitye"); GameRegistry.registerBlock(tileentitye, "tileentitye"); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityE.class, new TileEntityERenderer()); My problem is that there is no model and no texture i see a hitbox but there is nothing there
September 22, 201410 yr Where is your model class?? and did you put ClientRegistry.bindTileEntitySpecialRenderer(TileEntityE.class, new TileEntityERenderer()); in the clientproxy file???
September 23, 201410 yr Well... @Override public TileEntity createNewTileEntity(World arg0, int arg1) { // TODO Auto-generated method stub return new TileEntityTank(); } ClientRegistry.bindTileEntitySpecialRenderer(TileEntityE.class, new TileEntityERenderer()); Here's your problem... Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
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.