Jump to content

Xcox123

Members
  • Posts

    96
  • Joined

  • Last visited

Posts posted by Xcox123

  1. package com.xcox123.tehfoodmod.renderer.tileentity;
    
    import org.lwjgl.opengl.GL11;
    
    import com.xcox123.tehfoodmod.tehfoodmod;
    import com.xcox123.tehfoodmod.Block.BlockWindmill;
    
    import cpw.mods.fml.common.FMLCommonHandler;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import net.minecraft.init.Blocks;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;
    
    /**
    * Created by Adam on 20/08/2014.
    */
    public class TileEntityRenderWindmill extends TileEntitySpecialRenderer {
    private final ResourceLocation textureWindmill = new ResourceLocation("tehfoodmod", "textures/model/windmill.png");
    
    private int textureWidth = 64;
    private int textureHeight = 32;
    
        @Override
        public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
        	GL11.glPushMatrix();
        	GL11.glTranslatef((float)x, (float)y, (float)z);
        	
        	Tessellator tess = Tessellator.instance;
        	this.bindTexture(textureWindmill);
        	IBlockAccess world = tileentity.getWorldObj();
        	
        
        	tess.startDrawingQuads(); //Starts drawing
        	{
        		tess.addVertexWithUV(0, 0, 1, 1, 1);
        		tess.addVertexWithUV(1, 1, 1, 1, 0);
        		tess.addVertexWithUV(0, 1, 0, 0, 0);
        		tess.addVertexWithUV(0, 0, 0, 0, 1);
        	}
        	
        	tess.draw(); //Draws
        	int brightness = tehfoodmod.blockWindmill.getMixedBrightnessForBlock(world, tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
    
    	tess.setBrightness(brightness);
    	tess.setColorOpaque_F(1.0F, 1.0F, 1.0F);
    
    	/*
    	 * Tried brightness code above outside of GL11.glPopMatrix() and same effect happens
    	 */
        	GL11.glPopMatrix();
        	
        }
    }
    

     

    OnX093t.png

     

    Texture: lnXa9lD.png

     

    Just saying, ^^ is found at this path: C:\Users\Adam\Desktop\Modding\1.7\TehFoodMod\Source\src\main\resources\assets\tehfoodmod\textures\model

  2. Nope, still black, heres my code now

    public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
        	GL11.glPushMatrix();
        	GL11.glTranslatef((float)x, (float)y, (float)z);
        	
        	Tessellator tess = Tessellator.instance;
        	this.bindTexture(textureWindmill);
        	IBlockAccess world = tileentity.getWorldObj();
        	int brightness = tehfoodmod.blockWindmill.getMixedBrightnessForBlock(world, tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
    
    	tess.setBrightness(brightness);
    	tess.setColorOpaque_F(1.0F, 1.0F, 1.0F);
        
        	tess.startDrawingQuads(); //Starts drawing
        	{
        		tess.addVertexWithUV(0, 0, 1, 1, 1);
        		tess.addVertexWithUV(1, 1, 1, 1, 0);
        		tess.addVertexWithUV(0, 1, 0, 0, 0);
        		tess.addVertexWithUV(0, 0, 0, 0, 1);
        	}
        	tess.draw(); //Draws
        	GL11.glPopMatrix();
        }
    

  3. Hey, I was making a custom rendered block with Tesselators for the first time, and when I saw my block the place where my .png was supposed to be placed was black(my png is bright pink). Can anyone help? Heres my rendering code:

     

    public class TileEntityRenderWindmill extends TileEntitySpecialRenderer {
    private final ResourceLocation textureWindmill = new ResourceLocation("tehfoodmod", "textures/model/windmill.png");
    
    private int textureWidth = 64;
    private int textureHeight = 32;
    
        @Override
        public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
        	GL11.glPushMatrix();
        	GL11.glTranslatef((float)x, (float)y, (float)z);
        	
        	
        	Tessellator tess = Tessellator.instance;
        	this.bindTexture(textureWindmill);
        	tess.startDrawingQuads(); //Starts drawing
        	{
        		tess.addVertexWithUV(0, 0, 1, 1, 1);
        		tess.addVertexWithUV(1, 1, 1, 1, 0);
        		tess.addVertexWithUV(0, 1, 0, 0, 0);
        		tess.addVertexWithUV(0, 0, 0, 0, 1);
        	}
        	tess.draw(); //Draws
        	GL11.glPopMatrix();
        }
    }
    

  4. 1. Use spoiler tags for code

    2. Please actually try googling before posting here.. there are plenty of tutorials on how to do this.

    Heres what you've done wrong(so you know)

     

    1. Do not declare BedrockPiece as Item(). Make your own class.

    2. You have not included @SideOnly(Side.CLIENT) in your code anywhere. This goes in your own class you made above

    3. You have 2 public void init's, why?

    4. You have not set the ItemID.

     

    Really... what do you expect. Code doesn't go "oh I guess he'll want a texture for this... lets try and find it". You need to tell it exactly what do to. Where in your code do you think you've told it to load a texture?

     

     

  5. I started learning minecraft modding in 1.6. Then, I took a month or two break(by that time 1.7 was out). From rumors I heard, 1.7 is quite differant from 1.6. I decided that I would learn everything in 1.6, try and get a good understanding on how to do things, and then update everything to 1.7. Thats what I'm doing.

×
×
  • Create New...

Important Information

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