Jump to content

Blu_Nighttime

Members
  • Posts

    30
  • Joined

  • Last visited

Posts posted by Blu_Nighttime

  1. A pic of the class for the tool (no methods are deprecated).

     

    A couple variables:

    public static ToolMaterial MATERIAL = EnumHelper.addToolMaterial("MATERIAL", 0, 2048, 1.5F, 1.0F, 0);

    private static final Set EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.AIR});

     

    Calling and registering:

    pulverizertool = new ItemPulverizerTool(0.5F,MATERIAL,EFFECTIVE_ON);

    GameRegistry.register(pulverizertool);

     

    Crafting:

    GameRegistry.addShapedRecipe(new ItemStack(ModItems.stonedust,9), "PS ", " ", " ",'P', new ItemStack(ModItems.pulverizertool,1,OreDictionary.WILDCARD_VALUE),'S',Blocks.STONE);

     

     

    When the tool is used in crafting and product is made, the tool has a red zero next to it and disappears on click. I'm struggling to solve this one issue.

    modpic.png

  2. package mstrTiggyI.MoreBlocks.items;

     

    import mstrTiggyI.MoreBlocks.MoreBlocks;
    import mstrTiggyI.MoreBlocks.Reference;
    import mstrTiggyI.MoreBlocks.init.ModItems;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.item.ItemTool;

     

     

    public class ItemPulverizerTool extends Item {
     
     private ItemStack emptyItem = null;
     private static int maxDamage = 2048;
     
     public ItemPulverizerTool(){
          setUnlocalizedName(Reference.MoreBlocksItems.PULVERIZERTOOL.getUnlocalizedName());
          setRegistryName(Reference.MoreBlocksItems.PULVERIZERTOOL.getRegistryName());
          setCreativeTab(MoreBlocks.CREATIVE_TAB);
          setMaxDamage(maxDamage);
          setMaxStackSize(1);
          setNoRepair();

     }
     @Override
     public boolean hasContainerItem() {
         return true;
     }


     public void setEmptyItem(ItemStack ei) {
         this.emptyItem = ei;
     }

     

     public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack) {
         return false;
     }


     public ItemStack getContainerItemStack(ItemStack stack) {
         int dmg = stack.getItemDamage();
         if (dmg == maxDamage) {
         return new ItemStack(stack.getItem(), 0, maxDamage);
         }
         ItemStack tr = copyStack(stack, 1);
         tr.setItemDamage(dmg + 1);
         return tr;
     }


     public static ItemStack copyStack(ItemStack stack, int n) {
         return new ItemStack(stack.itemID, n, stack.getItemDamage());
         }
    }

     

    This is the code. The problem is that (where underlined) is saying that field cannot be Resolved. It recommends using .getItem() but that crashes the game. I'm not sure what to use nor do?!

×
×
  • Create New...

Important Information

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