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

[1.8] Custom tool not rendering


cclloyd9785
 Share

Recommended Posts

Not sure why, but my custom tool isn't rendering at all.  Not sure what's wrong.

 

Render statement:

ItemModelMesher renderItem = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
public static ItemToolHammerDiamond itemToolHammerDiamond = new ItemToolHammerDiamond();
renderItem.register(itemToolHammerDiamond, 0, new ModelResourceLocation(CCModpack.MODID + ":" + ItemToolHammerDiamond.name, "inventory"));

 

Hammer Base:

package com.cclloyd.ccmodpack.itemtool;

import java.util.Set;

import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;

import com.cclloyd.ccmodpack.BlockRegistry;
import com.google.common.collect.Sets;

public class ItemToolHammer extends ItemTool {

public static final String name = "itemToolHammer";

static float attackDamage;
static ToolMaterial material;

@SuppressWarnings("rawtypes")
static Set effectiveBlocks = Sets.newHashSet(new Block[] {Blocks.stone, Blocks.sand, Blocks.cobblestone, Blocks.brick_block});
  
public ItemToolHammer(float attackDamage, ToolMaterial material) { 
	super(attackDamage, material, effectiveBlocks);
	final int WOOD_HARDNESS_LEVEL = 0;
	final int STONE_HARDNESS_LEVEL = 1;
	this.setHarvestLevel("axe", WOOD_HARDNESS_LEVEL); 
	this.setHarvestLevel("pickaxe", STONE_HARDNESS_LEVEL);
  }

  @Override
  public float getStrVsBlock(ItemStack stack, Block block) {
    Float result = super.getStrVsBlock(stack, block);
    return result;
  }

  @Override
  public float getDigSpeed(ItemStack stack, IBlockState state) {
    Float result = super.getDigSpeed(stack, state);
    return result;
  }

  	@Override
  	public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) {
  		Boolean result = true;
  		result = super.onBlockStartBreak(itemstack, pos, player);
  		return result;
  	}

@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
	Boolean result = true;

	if(!worldIn.isRemote) {
		// Stone/Cobblestone > Gravel
		if (blockIn == Blocks.stone)
			spawnDifferentBlock(Blocks.gravel, worldIn, pos);
		else if (blockIn == Blocks.cobblestone)
			spawnDifferentBlock(Blocks.gravel, worldIn, pos);

		// Gravel > Sand
		else if (blockIn == Blocks.gravel)
			spawnDifferentBlock(Blocks.sand, worldIn, pos);

		// Sand > Dust
		else if (blockIn == Blocks.sand)
			spawnDifferentBlock(BlockRegistry.blockDust, worldIn, pos);

		// Brick Block > Bricks
		else if (blockIn == Blocks.brick_block)
			spawnDifferentBlockMulti(Items.brick, 4, worldIn, pos);

		// Stone brick > Cracked Stone Brick
		else if (blockIn == Blocks.stonebrick)
			spawnDifferentBlockMeta(Blocks.stonebrick, 2, worldIn, pos);

		// Netherrack > Soul Sand
		else if (blockIn == Blocks.netherrack)
			spawnDifferentBlock(Blocks.soul_sand, worldIn, pos);

		// Redstone block > redstone
		else if (blockIn == Blocks.redstone_block)
			spawnDifferentBlockMulti(Items.redstone, 9, worldIn, pos);

		// Lapis block > lapis
		else if (blockIn == Blocks.lapis_block)
			spawnDifferentBlockMultiMeta(Items.dye, 9, 4, worldIn, pos);


		// No special case
		else
			result = super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn);
	}
	else
		result = super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn);


	return result;
}
}

 

Diamond Hammer:

package com.cclloyd.ccmodpack.itemtool;

import com.cclloyd.ccmodpack.CCModpack;

public class ItemToolHammerDiamond extends ItemToolHammer {

public static final String name = "itemToolHammerDiamond";

public static float attackDamage = 5.0F;
public static ToolMaterial material = ToolMaterial.EMERALD;

public ItemToolHammerDiamond() {
	super(attackDamage, material);
	setUnlocalizedName(CCModpack.MODID + "_" + name);
}

}

 

assets/modid/models/item/itemToolHammerDiamond.json

{
    "parent": "builtin/generated",
    "textures": {
        "layer0": "ccmodpack:items/itemToolHammerDiamond"
    },
    "display": {
        "thirdperson": {
            "rotation": [ 0, 90, -35 ],
            "translation": [ 0, 1.25, -3.5 ],
            "scale": [ 0.85, 0.85, 0.85 ]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.7, 1.7, 1.7 ]
        }
    }
}

 

And there's the png in textures/items/itemToolHammerDiamond.png

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