I fixed the 3D ItemBlock but I still can't register an Icon to it even though when I hopped over to the hopper class the registerIcon bit of code was the same.
I am trying to make a 3D item but for some reason it wont work (Probably because of outdated tutorials). I get no errors but the texture is purple and not 3d. I followed ScratchForFun's tutorial.
public class ItemRendererCustomBlock implements IItemRenderer{
private ModelCustomBlock model;
private static ResourceLocation texture = new ResourceLocation(Reference.MODID,"textures/model/Bucket.png");
private static RenderItem renderItem = new RenderItem();
public ItemRendererCustomBlock(){
model = new ModelCustomBlock();
}
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,ItemRendererHelper helper) {
return true;
}
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityCustomBlock(), 0.0d, 0.0d, 0.0d, 0.0f);
}
}
Item class:
public class CustomTestBlock extends BlockContainer{
public CustomTestBlock() {
super(Material.iron);
setBlockName("customTestBlock");
this.blockHardness = 2.0f;
this.setBlockBounds(1f/16f*6f, 0.0f, 1f/16f*6f, 1f-1f/16f*6f, 1f-1f/16f*11f,1f-1f/16f*6f);
this.setCreativeTab(CreativeTabs.tabDecorations);
}
public TileEntity createNewTileEntity(World world,int par2) {
return new TileEntityCustomBlock();
}
public int getRenderType()
{
return -9060;
}
public boolean renderAsNormalBlock()
{
return false;
}
public boolean isOpaqueCube()
{
return false;
}
@SideOnly(Side.CLIENT)
public Block getBlockDropped(int par1, Random par2, int par3)
{
return testmod.customtestblock;
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister icon){
this.blockIcon = icon.registerIcon(Reference.MODID + ":" + "customTestBlock");
}
}
ClientProxy class:
public class ClientProxy extends CommonProxy{
public void registerProxies(){
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCustomBlock.class, new RendererCustomBlock());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(testmod.testblock), new ItemRendererCustomBlock());
}
}
Tile Entity Class (Not much):
public class TileEntityCustomBlock extends TileEntity {
}
Thanks in advance!
I want to create a custom rendered block for my testmod, so I searched for tutorials but all of them seem to be out of date(The most recent tutorial I found was for 1.6.4). I decided to learn from vanilla custom rendered blocks but I don't know where to look and all I found was this function in the block class:
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return 0;
}
0
About a month ago I created a test mod just for fun. I stopped developing it because I got bored so I decided to share the code with you guys!
Please note that it is FULL of bugs, the build didn't go so well for me so the code version works better.
Code download:
Mod Download(Buggy not recommended):
0
EDIT: Nvm I'm not sure why id did not work the first time!!!! This makes me facepalm so much! Thanks for the help man I really appreciate it!
0
0
0
EDIT: I just failed so much!!!!! I registered it to the wrong block in the CLientProxy
But I still need to set an Icon because the particles are purple.
0
0
0
Custom block model class:
Item Renderer class:
Item class:
ClientProxy class:
Tile Entity Class (Not much):
0
Thanks dude I still don't know how I did not think of that!
0
The code
I need something like this:
Thanks!
0
0
Please help me!
Thanks in advance!
0
0
Now I really don't know why it does't work.
0