Alright, so i decided to make a custom rendered block. and it works, but its all black, like everything is dark. So i was wondering if anyone knew how to fix this? I would really appreciate the help. sincerely killerjdog51
public class Blocks {
public static void mainRegistry(){
initialiseItem();
registerItem();
}
public static Block Trophy;
public static void initialiseItem(){
Trophy = new BlockTrophy(Material.rock).setHardness(1.0F).setStepSound(Block.soundTypePiston).setBlockName("trophy").setBlockTextureName("").setCreativeTab(MainRegistry.tabDeerMod);
}
public static void registerItem(){
GameRegistry.registerBlock(Trophy, Trophy.getUnlocalizedName());
private static final ModelHelmet tutChest = new ModelHelmet(1.0f);
private static final ModelHelmet tutLegs = new ModelHelmet(0.5f);
@Override
public ModelBiped getArmorModel(int id){ switch (id) {
case 0: return tutChest; case 1: return tutLegs; default: break; }
return tutChest; //default, if whenever you should have passed on a wrong id } }
}
@Override
public void registerRenderers(){
//RenderingRegistry.registerEntityRenderingHandler(Entitycocoacow.class, new Rendercocoacow(new Modelcocoacow(), 0.3F));
I might be wrong but in your render class, it should be public static final ResourceLocation texture = new ResourceLocation("deermod", "textures/models/blocks/trophy.png");
It doesn't matter how you do resource-location, it's all going to be the same in the end.
Try doing
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
just before you render the model. If that doesn't work, use this method instead. Note, you do need to use a tessellator.
Blocks.class
package com.Deer.Blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import com.Deer.Config.config;
import com.Deer.Main.MainRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
public class Blocks {
public static void mainRegistry(){
initialiseItem();
registerItem();
}
public static Block Trophy;
public static void initialiseItem(){
Trophy = new BlockTrophy(Material.rock).setHardness(1.0F).setStepSound(Block.soundTypePiston).setBlockName("trophy").setBlockTextureName("").setCreativeTab(MainRegistry.tabDeerMod);
}
public static void registerItem(){
GameRegistry.registerBlock(Trophy, Trophy.getUnlocalizedName());
}
}
BlockTrophy.class
package com.Deer.Blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BlockTrophy extends BlockContainer{
protected BlockTrophy(Material p_i45386_1_) {
super(p_i45386_1_);
// TODO Auto-generated constructor stub
}
public int getRenderType(){
return -1;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock(){
return false;
}
@Override
public TileEntity createNewTileEntity(World var1, int var2) {
// TODO Auto-generated method stub
return new TileEntityTrophy();
}
}
RenderTrophy.class
package com.Deer.Blocks;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public class RenderTrophy extends TileEntitySpecialRenderer{
public static final ResourceLocation texture = new ResourceLocation("deermod:textures/models/blocks/trophy.png");
private ModelTrophy model;
public RenderTrophy(){
this.model = new ModelTrophy();
}
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f);
GL11.glRotatef(180, 0f, 0f, 1f);
this.bindTexture(texture);
GL11.glPushMatrix();
this.model.renderModel(0.0625f);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}
ModelTrophy.class
// Date: 8/11/2014 8:40:08 AM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package com.Deer.Blocks;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelTrophy extends ModelBase
{
//fields
ModelRenderer Base1;
ModelRenderer Base2;
ModelRenderer Base3;
ModelRenderer Base4;
ModelRenderer Base5;
ModelRenderer Base6;
ModelRenderer Base7;
ModelRenderer Base8;
ModelRenderer Base9;
ModelRenderer RightAntler1;
ModelRenderer RightAntler2;
ModelRenderer RightAntler3;
ModelRenderer RightAntler4;
ModelRenderer RightAntler5;
ModelRenderer LeftAntler1;
ModelRenderer LeftAntler2;
ModelRenderer LeftAntler3;
ModelRenderer LeftAntler4;
ModelRenderer LeftAntler5;
public ModelTrophy()
{
textureWidth = 64;
textureHeight = 64;
Base1 = new ModelRenderer(this, 0, 0);
Base1.addBox(-8F, -8F, 0F, 10, 10, 2);
Base1.setRotationPoint(3F, 20F, 6F);
Base1.setTextureSize(64, 64);
Base1.mirror = true;
setRotation(Base1, 0F, 0F, 0F);
Base2 = new ModelRenderer(this, 0, 13);
Base2.addBox(0F, 0F, 0F, 8, 1, 2);
Base2.setRotationPoint(-4F, 22F, 6F);
Base2.setTextureSize(64, 64);
Base2.mirror = true;
setRotation(Base2, 0F, 0F, 0F);
Base3 = new ModelRenderer(this, 0, 17);
Base3.addBox(0F, 0F, 0F, 6, 1, 2);
Base3.setRotationPoint(-3F, 23F, 6F);
Base3.setTextureSize(64, 64);
Base3.mirror = true;
setRotation(Base3, 0F, 0F, 0F);
Base4 = new ModelRenderer(this, 21, 13);
Base4.addBox(0F, -1F, 0F, 8, 1, 2);
Base4.setRotationPoint(-4F, 12F, 6F);
Base4.setTextureSize(64, 64);
Base4.mirror = true;
setRotation(Base4, 0F, 0F, 0F);
Base5 = new ModelRenderer(this, 21, 17);
Base5.addBox(0F, 0F, 0F, 6, 1, 2);
Base5.setRotationPoint(-3F, 10F, 6F);
Base5.setTextureSize(64, 64);
Base5.mirror = true;
setRotation(Base5, 0F, 0F, 0F);
Base6 = new ModelRenderer(this, 21, 21);
Base6.addBox(0F, 0F, 0F, 1, 8, 2);
Base6.setRotationPoint(5F, 13F, 6F);
Base6.setTextureSize(64, 64);
Base6.mirror = true;
setRotation(Base6, 0F, 0F, 0F);
Base7 = new ModelRenderer(this, 7, 21);
Base7.addBox(1F, 0F, 0F, 1, 6, 2);
Base7.setRotationPoint(5F, 14F, 6F);
Base7.setTextureSize(64, 64);
Base7.mirror = true;
setRotation(Base7, 0F, 0F, 0F);
Base8 = new ModelRenderer(this, 0, 21);
Base8.addBox(-1F, 0F, 0F, 1, 8, 2);
Base8.setRotationPoint(-5F, 13F, 6F);
Base8.setTextureSize(64, 64);
Base8.mirror = true;
setRotation(Base8, 0F, 0F, 0F);
Base9 = new ModelRenderer(this, 7, 21);
Base9.addBox(0F, 0F, 0F, 1, 6, 2);
Base9.setRotationPoint(-7F, 14F, 6F);
Base9.setTextureSize(64, 64);
Base9.mirror = true;
setRotation(Base9, 0F, 0F, 0F);
RightAntler1 = new ModelRenderer(this, 29, 0);
RightAntler1.addBox(0F, 0F, -2F, 1, 1, 6);
RightAntler1.setRotationPoint(-3F, 19F, 2F);
RightAntler1.setTextureSize(64, 64);
RightAntler1.mirror = true;
setRotation(RightAntler1, 0F, 0F, 0F);
RightAntler2 = new ModelRenderer(this, 58, 0);
RightAntler2.addBox(0F, 0F, 0F, 1, 1, 1);
RightAntler2.setRotationPoint(-3F, 18F, 1F);
RightAntler2.setTextureSize(64, 64);
RightAntler2.mirror = true;
setRotation(RightAntler2, 0F, 0F, 0F);
RightAntler3 = new ModelRenderer(this, 39, 8);
RightAntler3.addBox(0F, 0F, 0F, 1, 4, 1);
RightAntler3.setRotationPoint(-3F, 15F, 4F);
RightAntler3.setTextureSize(64, 64);
RightAntler3.mirror = true;
setRotation(RightAntler3, 0F, 0F, 0F);
RightAntler4 = new ModelRenderer(this, 44, 0);
RightAntler4.addBox(0F, 0F, 0F, 1, 1, 3);
RightAntler4.setRotationPoint(-3F, 16F, 1F);
RightAntler4.setTextureSize(64, 64);
RightAntler4.mirror = true;
setRotation(RightAntler4, 0F, 0F, 0F);
RightAntler5 = new ModelRenderer(this, 53, 0);
RightAntler5.addBox(0F, 0F, 0F, 1, 2, 1);
RightAntler5.setRotationPoint(-3F, 14F, 2F);
RightAntler5.setTextureSize(64, 64);
RightAntler5.mirror = true;
setRotation(RightAntler5, 0F, 0F, 0F);
LeftAntler1 = new ModelRenderer(this, 29, 0);
LeftAntler1.addBox(0F, 0F, 0F, 1, 1, 6);
LeftAntler1.setRotationPoint(2F, 19F, 0F);
LeftAntler1.setTextureSize(64, 64);
LeftAntler1.mirror = true;
setRotation(LeftAntler1, 0F, 0F, 0F);
LeftAntler2 = new ModelRenderer(this, 58, 0);
LeftAntler2.addBox(0F, 0F, 0F, 1, 1, 1);
LeftAntler2.setRotationPoint(2F, 18F, 1F);
LeftAntler2.setTextureSize(64, 64);
LeftAntler2.mirror = true;
setRotation(LeftAntler2, 0F, 0F, 0F);
LeftAntler3 = new ModelRenderer(this, 39, 8);
LeftAntler3.addBox(0F, 0F, 0F, 1, 4, 1);
LeftAntler3.setRotationPoint(2F, 15F, 4F);
LeftAntler3.setTextureSize(64, 64);
LeftAntler3.mirror = true;
setRotation(LeftAntler3, 0F, 0F, 0F);
LeftAntler4 = new ModelRenderer(this, 44, 0);
LeftAntler4.addBox(0F, 0F, 0F, 1, 1, 3);
LeftAntler4.setRotationPoint(2F, 16F, 1F);
LeftAntler4.setTextureSize(64, 64);
LeftAntler4.mirror = true;
setRotation(LeftAntler4, 0F, 0F, 0F);
LeftAntler5 = new ModelRenderer(this, 53, 0);
LeftAntler5.addBox(0F, 0F, 0F, 1, 2, 1);
LeftAntler5.setRotationPoint(2F, 14F, 2F);
LeftAntler5.setTextureSize(64, 64);
LeftAntler5.mirror = true;
setRotation(LeftAntler5, 0F, 0F, 0F);
}
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, entity);
Base1.render(f5);
Base2.render(f5);
Base3.render(f5);
Base4.render(f5);
Base5.render(f5);
Base6.render(f5);
Base7.render(f5);
Base8.render(f5);
Base9.render(f5);
RightAntler1.render(f5);
RightAntler2.render(f5);
RightAntler3.render(f5);
RightAntler4.render(f5);
RightAntler5.render(f5);
LeftAntler1.render(f5);
LeftAntler2.render(f5);
LeftAntler3.render(f5);
LeftAntler4.render(f5);
LeftAntler5.render(f5);
}
public void renderModel(float f){
Base1.render(f);
Base2.render(f);
Base3.render(f);
Base4.render(f);
Base5.render(f);
Base6.render(f);
Base7.render(f);
Base8.render(f);
Base9.render(f);
RightAntler1.render(f);
RightAntler2.render(f);
RightAntler3.render(f);
RightAntler4.render(f);
RightAntler5.render(f);
LeftAntler1.render(f);
LeftAntler2.render(f);
LeftAntler3.render(f);
LeftAntler4.render(f);
LeftAntler5.render(f);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}
TileEntityTrophy.class
package com.Deer.Blocks;
import net.minecraft.tileentity.TileEntity;
public class TileEntityTrophy extends TileEntity {
}
ClientProxy
package com.Deer.Main;
import com.Deer.Armor.ModelHelmet;
import com.Deer.Blocks.RenderTrophy;
import com.Deer.Blocks.TileEntityTrophy;
import com.Deer.Mobs.EntityDeer;
import com.Deer.Mobs.ModelDeer;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
public class ClientProxy extends CommonProxy {
private static final ModelHelmet tutChest = new ModelHelmet(1.0f);
private static final ModelHelmet tutLegs = new ModelHelmet(0.5f);
@Override
public ModelBiped getArmorModel(int id){ switch (id) {
case 0: return tutChest; case 1: return tutLegs; default: break; }
return tutChest; //default, if whenever you should have passed on a wrong id } }
}
@Override
public void registerRenderers(){
//RenderingRegistry.registerEntityRenderingHandler(Entitycocoacow.class, new Rendercocoacow(new Modelcocoacow(), 0.3F));
RenderingRegistry.addNewArmourRendererPrefix("DeerHideArmor");
RenderingRegistry.registerEntityRenderingHandler(EntityDeer.class, new RenderDeer(new ModelDeer(), 0.5F));
TileEntitySpecialRenderer render = new RenderTrophy();
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTrophy.class, render);
}
}
It doesn't matter how you do resource-location, it's all going to be the same in the end.
Try doing just before you render the model. If that doesn't work, use this method instead. Note, you do need to use a tessellator.