-
Posts
30 -
Joined
-
Last visited
Posts posted by Blu_Nighttime
-
-
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.
-
Right I've changed my code. Do I need to override hasContainerItem() and getContainerItem()?
-
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?!
-
Does anyone know where I can find a link or know how to make an item which, when crafted with, isn't destroyed but it uses durability. I've looked everywhere! Either they are out of date (older versions of mc) or they make no sense.
Thanks.
Minecraft Forge [1.10.2] - Durable Crafting Item (SOLVED)
in Modder Support
Posted
Hey thanks! I've managed to copy the item, although it's now indestructible, I now have something to work with. Now...how do I change the title to solve?