Posted October 22, 201212 yr I having a custom block renderer and when i place it ingame it will show nothing Here is the code: Main File: package net.minecraft.projectnavitas; import net.minecraft.src.BaseMod; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; import net.minecraft.src.Item; import net.minecraft.src.ModLoader; import net.minecraft.src.RenderBlocks; import net.minecraft.src.TileEntityRenderer; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; 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.network.NetworkMod; import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid="ProjectNavitas",name="Project Navitas",version="0.1") @NetworkMod(clientSideRequired=true, serverSideRequired=false, clientPacketHandlerSpec = @SidedPacketHandler(channels = {"ProjectNavitas" }, packetHandler = ClientPacketHandler.class), serverPacketHandlerSpec = @SidedPacketHandler(channels = {"ProjectNavitas" }, packetHandler = ServerPacketHandler.class)) public class ProjectNavitas{ @Instance("ProjectNavitas") public static ProjectNavitas instance = new ProjectNavitas(); @SidedProxy(clientSide="net.minecraft.projectnavitas.ClientProxy", serverSide= "net.minecraft.projectnavitas.CommonProxy") public static CommonProxy proxy; public static GuiHandler guiHandler = new GuiHandler(); public static final Item WhiteCrystalShard = new ItemWhiteCrystalShard(4000, CreativeTabs.tabMaterials, 0, "WhiteCrystalShard"); public static final Block WhiteCrystal = new BlockWhiteCrystal(3000, 0); @Init public void Init(FMLInitializationEvent event){ GameRegistry.registerBlock(WhiteCrystal); proxy.init(); LanguageRegistry.addName(WhiteCrystalShard, "White Crystal Shard"); LanguageRegistry.addName(WhiteCrystal, "White Crystal"); NetworkRegistry.instance().registerGuiHandler(this, guiHandler); } public void renderInvBlock(RenderBlocks var1, Block var2, int var3, int var4){ if (var4 == WhiteCrystal.getRenderType()) { TileEntityRenderer.instance.renderTileEntityAt(new TileEntityCrystal(), 0.0D, 0.0D, 0.0D, 0.0F); } } @PreInit public void PreInit(FMLPreInitializationEvent event){ } @PostInit public void PostInit(FMLPostInitializationEvent event){ } } BlockWhiteCrystal: package net.minecraft.projectnavitas; import java.util.Random; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; import net.minecraft.src.Material; import net.minecraft.src.TileEntity; public class BlockWhiteCrystal extends Block{ public BlockWhiteCrystal(int id, int texture) { super(id, texture, Material.rock); setHardness(1.0F); setResistance(2.0F); setCreativeTab(CreativeTabs.tabBlock); } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return -1; } public TileEntity getBlockEntity() { try{ return (TileEntity)TileEntityCrystal.class.newInstance(); } catch(Exception exception){ throw new RuntimeException(exception); } } public TileEntity TileEntity(){ return new TileEntityCrystal(); } } ClientProxy package net.minecraft.projectnavitas; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; public class ClientProxy extends CommonProxy{ public void init(){ initTileEntities(); LanguageRegistry.instance().addNameForObject(ProjectNavitas.WhiteCrystal, "en_US", "White Crystal"); } public void initTileEntities(){ GameRegistry.registerTileEntity(TileEntityCrystal.class, "tileCrystal"); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrystal.class, new TileEntityCrystalRenderer()); } } CommonProxy import java.util.Objects; import net.minecraft.src.EnumRarity; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.registry.GameRegistry; public class CommonProxy{ public void preInit() { registerGuiHandler(); } public void init() { initRenderingAndTextures(); initCustomRarityTypes(); initTileEntities(); } /** * Post-Initialization event handler method. Everything within this method is called after all * mods are done loading. */ public void postInit() { } public void registerRenderInformation() {} public void initRenderingAndTextures() {} public void initCustomRarityTypes() {} public void initTileEntities() { GameRegistry.registerTileEntity(TileEntityCrystal.class, "tileCrystal"); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrystal.class, new TileEntityCrystalRenderer()); } public EnumRarity getCustomRarityType(String customRarity) { return null; } public void registerGuiHandler() {} } Model package net.minecraft.projectnavitas; import net.minecraft.src.Entity; import net.minecraft.src.ModelBase; import net.minecraft.src.ModelRenderer; public class ModelProjector extends ModelBase{ //fields ModelRenderer Shape1; ModelRenderer Piece1; private int xyzz; ModelRenderer rendermap[] = new ModelRenderer[4096]; public ModelProjector() { textureWidth = 64; textureHeight = 32; xyzz = 0; for(float i = -8F; i<8F; i++){ for(float j = 8F; j<24F; j++){ for(float k = -8F; k<8F; k++){ rendermap[xyzz] = new ModelRenderer(this, 0, 0); rendermap[xyzz].addBox(i, j, k, 1, 1, 1); rendermap[xyzz].setRotationPoint(0F, 0F, 0F); rendermap[xyzz].setTextureSize(64, 32); setRotation(rendermap[xyzz], 0F, 0F, 0F); xyzz++; } } } Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(-8F, -8F, -8F, 16, 15, 16); Shape1.setRotationPoint(0F, 0F, 0F); Shape1.setTextureSize(64, 32); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); Piece1 = new ModelRenderer(this, "Piece1"); Piece1.setRotationPoint(0F, 0F, 0F); setRotation(Piece1, 0F, 0F, 0F); Piece1.mirror = true; } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5); Shape1.render(f5); for(int i = 0;i< 4096; i++){ rendermap[i].render(f5); } Piece1.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void renderModel(float f1) { Shape1.render(f1); for(int i = 0;i< 4096; i++){ rendermap[i].render(f1); } Piece1.render(f1); } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5); } } TileEntityCrystalRenderer package net.minecraft.projectnavitas; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import net.minecraft.src.Tessellator; import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntitySpecialRenderer; public class TileEntityCrystalRenderer extends TileEntitySpecialRenderer{ public TileEntityCrystalRenderer(){ model = new ModelProjector(); } public void renderAModelAt(TileEntityCrystal tile, double d, double d1, double d2, float f) { GL11.glPushMatrix(); GL11.glTranslatef((float)d + 0.5F, (float)d1 + 0.5F, (float)d2 + 0.5F); bindTextureByName("/projectnavitas/Projector.png"); GL11.glPushMatrix(); model.renderModel(0.625F); GL11.glPopMatrix(); GL11.glPopMatrix(); } public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { renderAModelAt((TileEntityCrystal) tileentity, d, d1, d2, f); //where to render } private ModelProjector model; } TileEntityCrystal package net.minecraft.projectnavitas; import net.minecraft.src.TileEntity; public class TileEntityCrystal extends TileEntity{ public TileEntityCrystal(){ } } Thanks in befor hand //Hirvio
November 2, 201212 yr BlockWhiteCrystal: package net.minecraft.projectnavitas; import java.util.Random; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; import net.minecraft.src.Material; import net.minecraft.src.TileEntity; public class BlockWhiteCrystal extends Block{ public BlockWhiteCrystal(int id, int texture) { super(id, texture, Material.rock); setHardness(1.0F); setResistance(2.0F); setCreativeTab(CreativeTabs.tabBlock); } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return -1; } public TileEntity getBlockEntity() { try{ return (TileEntity)TileEntityCrystal.class.newInstance(); } catch(Exception exception){ throw new RuntimeException(exception); } } public TileEntity TileEntity(){ return new TileEntityCrystal(); } } You should add methods: public boolean hasTileEntity(int metadata) and public TileEntity createTileEntity(World world, int metadata). I've had the same problem, because i hadn't second one added, don't know why is it so important. Also I guess that you should override methods onBlockAdded and breakBlock to make sure that there's creating and destroying tile entity to your block. And sorry for my English:) If you see a mistake in my post please tell me about it. Thanks and sorry for my English.
November 12, 201212 yr I am just wondering if you have found a resolution to this issue? I have now been working three days trying to get this working and I am also getting only a bounding box and nothing inside it rendering. I have been looking at open source code and I have been looking at out dated videos for mod loader as they are the only ones I can see. did you find the missing step that was making it invisible or did you find any good tutorials? thanks for any help you can provide Neoublie Author of Codename: Project Shadow if you do models and textures pm me. looking for some assistance.
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.