Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.10] Tessellator not rendering


MrNegaBlox
 Share

Recommended Posts

So I keep trying to figure out how to use this infamous tessellator. But I just keep coming up with a clear block. I don't know whats wrong with my code.

 

Can someone please tell me whats wrong?

 

Main:

package io.github.mrnegablox.conquestcore;

import io.github.mrnegablox.conquestcore.blocks.ConquestBanner;
import io.github.mrnegablox.conquestcore.blocks.ModBlocks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = Main.MODID, name = Main.MODNAME, version = Main.VERSION)
public class Main {



        public static final String MODID = "conquestnega";
        public static final String MODNAME = "Reign and Dominate";
        public static final String VERSION = "1.0.0";
        
        @Instance
        public static Main instance = new Main();
        
        @SidedProxy(clientSide="io.github.mrnegablox.conquestcore.ClientProxy", serverSide="io.github.mrnegablox.conquestcore.ServerProxy")
        public static CommonProxy proxy;
        
        /**
         * Run before anything else. Read your config, create blocks, items, etc, and 
         * register them with the GameRegistry.
         */
        @EventHandler
        public void preInit(FMLPreInitializationEvent e) {
        	ModBlocks.init();

        	
        }
        
        /**
         * Do your mod setup. Build whatever data structures you care about. Register recipes.
         */
        @EventHandler
        public void init(FMLInitializationEvent e) {
        	GameRegistry.registerTileEntity(io.github.mrnegablox.conquestcore.tile.BannerTile.class, "Banner"); 
        	proxy.registerRenderers();
        }
        
        /**
         * Handle interaction with other mods, complete your setup based on this.
         */
        @EventHandler
        public void postInit(FMLPostInitializationEvent e) {
        	
        	
        }
}

 

Blocks:

package io.github.mrnegablox.conquestcore.blocks;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.material.Material;

public class ModBlocks {

public static ConquestBanner Banner;

public static final void init() {
	Banner = new ConquestBanner(Material.carpet);
	registerBlocks();
}

private static void registerBlocks() {
	GameRegistry.registerBlock(Banner, "BannerConquest");

}



}

 

Client Proxy:

package io.github.mrnegablox.conquestcore;

import io.github.mrnegablox.conquestcore.render.BannerRender;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

public class ClientProxy extends CommonProxy {

    @Override
    public void preInit(FMLPreInitializationEvent e) {
        super.preInit(e);
        
    }
    
    public void registerTESR(){
    	ClientRegistry.bindTileEntitySpecialRenderer(io.github.mrnegablox.conquestcore.tile.BannerTile.class, new BannerRender());
    }

    @Override
    public void init(FMLInitializationEvent e) {
    	
        super.init(e);
    }

    @Override
    public void postInit(FMLPostInitializationEvent e) {
        super.postInit(e);
    }

}


 

Block:

package io.github.mrnegablox.conquestcore.blocks;

import io.github.mrnegablox.conquestcore.Main;
import io.github.mrnegablox.conquestcore.tile.BannerTile;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class ConquestBanner extends Block{

public String ItemName = "Banner";

protected ConquestBanner(Material p_i45394_1_) {
	super(Material.carpet);
	this.setBlockName(ItemName);
	this.setCreativeTab(CreativeTabs.tabMisc);
	this.setBlockTextureName(Main.MODID + ":Banner");
}




public TileEntity createTileEntity(World world, int metadata)
{
   return new BannerTile();
}
    
    //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;
    }
    
}



 

Render

package io.github.mrnegablox.conquestcore.render;

import org.lwjgl.opengl.GL11;

import io.github.mrnegablox.conquestcore.Main;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

public class BannerRender extends TileEntitySpecialRenderer{

TextureManager render = Minecraft.getMinecraft().renderEngine;
ResourceLocation texture;

public BannerRender(){
	texture = new ResourceLocation("conquestnega", "tutorialBlock");
}

@Override
public void renderTileEntityAt(TileEntity p_147500_1_, double x,
		double y, double z, float scale) {
	this.bindTexture(TextureMap.locationBlocksTexture);
	Tessellator tessellator = Tessellator.instance;
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z); // +1 so that our "drawing" appears 1 block over our block (to get a better view)
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(0, 0, 0, 0, 0);
    tessellator.addVertexWithUV(0, 1, 0, 0, 1);
    tessellator.addVertexWithUV(1, 1, 0, 1, 1);
    tessellator.addVertexWithUV(1, 0, 0, 1, 0);

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

    tessellator.draw();
    GL11.glPopMatrix();
	 }
}






 

Tile

package io.github.mrnegablox.conquestcore.tile;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;

public class BannerTile extends TileEntity{

public String OwnerName;

public void writetoNBT(NBTTagCompound par1){
	super.writeToNBT(par1);
	par1.setString("OwnerName", OwnerName);
}

public void readfromNBT(NBTTagCompound par1)
{
	super.readFromNBT(par1);
	this.OwnerName = par1.getString("OwnerName");		
}

}

 

Thank you in Advance!

Link to comment
Share on other sites

You never call your

registerTESR()

method...

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/

Link to comment
Share on other sites

Main:

package io.github.mrnegablox.conquestcore;

import io.github.mrnegablox.conquestcore.blocks.ModBlocks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = Main.MODID, name = Main.MODNAME, version = Main.VERSION)
public class Main {



        public static final String MODID = "conquestnega";
        public static final String MODNAME = "Reign and Dominate";
        public static final String VERSION = "1.0.0";
        
        @Instance
        public static Main instance = new Main();
        
        @SidedProxy(clientSide="io.github.mrnegablox.conquestcore.ClientProxy", serverSide="io.github.mrnegablox.conquestcore.ServerProxy")
        public static CommonProxy proxy;
        
        /**
         * Run before anything else. Read your config, create blocks, items, etc, and 
         * register them with the GameRegistry.
         */
        @EventHandler
        public void preInit(FMLPreInitializationEvent e) {
        	ModBlocks.init();

        	
        }
        
        /**
         * Do your mod setup. Build whatever data structures you care about. Register recipes.
         */
        @EventHandler
        public void init(FMLInitializationEvent e) {
        	io.github.mrnegablox.conquestcore.CommonProxy.registerRenderThings();
            GameRegistry.registerTileEntity(io.github.mrnegablox.conquestcore.tile.BannerTile.class, "tileEntityBanner");
        }
        
        /**
         * Handle interaction with other mods, complete your setup based on this.
         */
        @EventHandler
        public void postInit(FMLPostInitializationEvent e) {
        	
        	
        }
}

 

Common Proxy:

package io.github.mrnegablox.conquestcore;

import io.github.mrnegablox.conquestcore.render.BannerRender;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;



public class CommonProxy {

public static void registerRenderThings(){
	ClientRegistry.bindTileEntitySpecialRenderer(io.github.mrnegablox.conquestcore.tile.BannerTile.class, new BannerRender());
}

    public void preInit(FMLPreInitializationEvent e) {
    	
    }

    public void init(FMLInitializationEvent e) {

    }

    public void postInit(FMLPostInitializationEvent e) {

    }
}

 

Client Proxy:

package io.github.mrnegablox.conquestcore;

import io.github.mrnegablox.conquestcore.render.BannerRender;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

public class ClientProxy extends CommonProxy {

    @Override
    public void preInit(FMLPreInitializationEvent e) {
        super.preInit(e);
        
    }
   
    public static void registerRenderThings() {
        ClientRegistry.bindTileEntitySpecialRenderer(io.github.mrnegablox.conquestcore.tile.BannerTile.class, new BannerRender());
}

    @Override
    public void init(FMLInitializationEvent e) {
    	
        super.init(e);
    }

    @Override
    public void postInit(FMLPostInitializationEvent e) {
        super.postInit(e);
    }

}


 

Block:

package io.github.mrnegablox.conquestcore.blocks;

import io.github.mrnegablox.conquestcore.Main;
import io.github.mrnegablox.conquestcore.tile.BannerTile;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class ConquestBanner extends Block{

public String ItemName = "Banner";

protected ConquestBanner(Material p_i45394_1_) {
	super(Material.carpet);
	this.setBlockName(ItemName);
	this.setCreativeTab(CreativeTabs.tabMisc);
	this.setBlockTextureName(Main.MODID + ":tutorialBlock");
}




public TileEntity createTileEntity(World world, int metadata)
{
   return new BannerTile();
}
    
    //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;
    }
    
}



 

RenderClass:

package io.github.mrnegablox.conquestcore.render;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

public class BannerRender extends TileEntitySpecialRenderer{

TextureManager render = Minecraft.getMinecraft().renderEngine;
ResourceLocation texture;

public BannerRender(){
	texture = new ResourceLocation("conquestnega", "tutorialBlock");
}
@Override
public void renderTileEntityAt(TileEntity tile, double x,
		double y, double z, float scale) {
	System.out.print("Renderout");
	Minecraft.getMinecraft().renderEngine.bindTexture(texture);
	Tessellator tessellator = Tessellator.instance;
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z); // +1 so that our "drawing" appears 1 block over our block (to get a better view)
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(0, 0, 0, 0, 0);
    tessellator.addVertexWithUV(0, 1, 0, 0, 1);
    tessellator.addVertexWithUV(1, 1, 0, 1, 1);
    tessellator.addVertexWithUV(1, 0, 0, 1, 0);

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

    tessellator.draw();
    GL11.glPopMatrix();
    
	 }
}






 

Tile:

package io.github.mrnegablox.conquestcore.tile;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;

public class BannerTile extends TileEntity{

//public String OwnerName;

/**public void writetoNBT(NBTTagCompound par1){
	super.writeToNBT(par1);
	par1.setString("OwnerName", OwnerName);
}

public void readfromNBT(NBTTagCompound par1)
{
	super.readFromNBT(par1);
	this.OwnerName = par1.getString("OwnerName");		
} **/

}

Link to comment
Share on other sites

You don't understand (from what i can see in te code) the use of proxies. Go look up a tutorial on how to use proxies.

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/

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

 Share



×
×
  • Create New...

Important Information

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