Java Code Examples for net.minecraft.item.ItemHoe

The following are top voted examples for showing how to use net.minecraft.item.ItemHoe. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Randores2   File: MaterialDefinitionGenerator.java   View source code 6 votes vote down vote up
public static void applyBackers(List<MaterialDefinition> definitions) {
    for (MaterialDefinition definition : definitions) {
        ToolMaterial toolMaterial = definition.getToolMaterial();
        ArmorMaterial armorMaterial = definition.getArmorMaterial();

        RandoresItemData itemData = definition.getData();

        RandoresItems.hoe.registerBacker(itemData, new ItemHoe(toolMaterial));
        RandoresItems.sword.registerBacker(itemData, new ItemSword(toolMaterial));
        RandoresItems.axe.registerBacker(itemData, new ConstructableAxe(toolMaterial, toolMaterial.getDamageVsEntity() + 5f, -3f));
        RandoresItems.shovel.registerBacker(itemData, new ItemSpade(toolMaterial));
        RandoresItems.pickaxe.registerBacker(itemData, new ConstructablePickaxe(toolMaterial));
        RandoresItems.battleaxe.registerBacker(itemData, new ConstructableAxe(toolMaterial, toolMaterial.getDamageVsEntity() + 8f, -3.5f));
        RandoresItems.helmet.registerBacker(itemData, armorMaterial);
        RandoresItems.chestplate.registerBacker(itemData, armorMaterial);
        RandoresItems.leggings.registerBacker(itemData, armorMaterial);
        RandoresItems.boots.registerBacker(itemData, armorMaterial);
    }
}
 
Example 2
Project: EMC   File: IItem.java   View source code 6 votes vote down vote up
public boolean instanceOf(IItemType type) {
	if (type.equals(IItemType.ItemFishingRod)) {
		return item instanceof ItemFishingRod;
	} else if (type.equals(IItemType.ItemPotion)) {
		return item instanceof ItemPotion;
	} else if (type.equals(IItemType.ItemFood)) {
		return item instanceof ItemFood;
	} else if (type.equals(IItemType.ItemSword)) {
		return item instanceof ItemSword;
	} else if (type.equals(IItemType.ItemTool)) {
		return item instanceof ItemTool;
	} else if (type.equals(IItemType.ItemNameTag)) {
		return item instanceof ItemNameTag;
	} else if (type.equals(IItemType.ItemBlock)) {
		return item instanceof ItemBlock;
	} else if (type.equals(IItemType.ItemHoe)) {
		return item instanceof ItemHoe;
	}
	return false;
}
 
Example 3
Project: BIGB   File: AutoCreateForOres.java   View source code 6 votes vote down vote up
/**
 * Finds or creates a hoe for an ore.
 */
public static void PopulateHoe(OreStuff stuff)
{
	if (!stuff.HasHoe)
	{
		Item Hoe = Util.FindItemFromString(stuff.BaseName + "hoe");
		
		if (Hoe != null)
		{
			stuff.HasHoe = true;
		}
		else
		{
			ItemHoe hoe;
			hoe = AutoItemAndBlock.CreateHoe(stuff.MetalMaterial, ModTabs.maintab, stuff.MetalMaterial.getHarvestLevel(), Reference.MODID + ":MissingHoeTexture", stuff.BaseName + "Hoe");
			stuff.Hoe = hoe;
		}
	}
}
 
Example 4
Project: Nuclear-Foundation   File: EventHandler.java   View source code 6 votes vote down vote up
public boolean isBlazonium(EntityPlayer player){
	ItemStack item=player.getHeldItemMainhand();
	if(item==null)
		return false;
	if(item.getItem()instanceof ItemTool){
		if(((ItemTool)(item.getItem())).getToolMaterial()==ToolMaterials.Blazonium)
				return true;
	}
	if(item.getItem()instanceof ItemSword){
		if(((ItemSword)(item.getItem())).getToolMaterialName().equals("Blazonium"))
				return true;
	}
	if(item.getItem()instanceof ItemHoe){
		if(((ItemHoe)(item.getItem())).getMaterialName().equals("Blazonium"))
				return true;
	}
	return false;
}
 
Example 5
Project: Nuclear-Foundation   File: EventHandler.java   View source code 6 votes vote down vote up
public boolean isEmerald(EntityPlayer player){
	ItemStack item=player.getHeldItemMainhand();
	if(item==null)
		return false;
	if(item.getItem()instanceof ItemTool){
		if(((ItemTool)(item.getItem())).getToolMaterial()==ToolMaterials.Emerald)
				return true;
	}
	if(item.getItem()instanceof ItemSword){
		if(((ItemSword)(item.getItem())).getToolMaterialName().equals("Emerald"))
				return true;
	}
	if(item.getItem()instanceof ItemHoe){
		if(((ItemHoe)(item.getItem())).getMaterialName().equals("Emerald"))
				return true;
	}
	return false;
}
 
Example 6
Project: DimsumCraft   File: ESteamFurnace.java   View source code 6 votes vote down vote up
private int getItemBurnTime(ItemStack stack) {
    if (stack == null || stack.stackSize <= 0) {
        return 0;
    } else {
        Item item = stack.getItem();
        if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) {
            Block block = Block.getBlockFromItem(item);
            if (block == Blocks.wooden_slab) return 150;
            if (block.getMaterial() == Material.wood) return 300;
            if (block == Blocks.coal_block) return 16000;
        }
        if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemHoe && ((ItemHoe) item).getMaterialName().equals("WOOD")) return 200;
        if (item == Items.stick) return 100;
        if (item == Items.coal) return 1600;
        if (item == Items.lava_bucket) return 20000;
        if (item == Item.getItemFromBlock(Blocks.sapling)) return 100;
        if (item == Items.blaze_rod) return 2400;
        return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(stack);
    }
}
 
Example 7
Project: toolscompressor   File: ScanningForToolsEvent.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void addVanillaTools(ValidatingToolsEvent event){
	Iterator<Item> iterator = Item.itemRegistry.iterator();
	while(iterator.hasNext()){
		Item i = iterator.next();
		if(i instanceof ItemSword){
			event.addSword(i);
		}
		if(i instanceof ItemPickaxe){
			event.addPickaxe(i);
		}
		if(i instanceof ItemSpade){
			event.addShovel(i);
		}
		if(i instanceof ItemAxe){
			event.addAxe(i);
		}
		if(i instanceof ItemHoe){
			event.addHoe(i);
		}
	}
}
 
Example 8
Project: Minestrappolation-4   File: BlockVirtianSoil.java   View source code 6 votes vote down vote up
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
	if (playerIn.getHeldItem() != null)
	{
		if (playerIn.getHeldItem().getItem() instanceof ItemHoe && state.getValue(VARIANT).getMetadata() == 1)
		{
			if (playerIn.getHeldItem().getItemDamage() < playerIn.getHeldItem().getMaxDamage())
				playerIn.getHeldItem().damageItem(1, playerIn);
			else
				playerIn.destroyCurrentEquippedItem();
			worldIn.setBlockState(pos, MBlocks.virtian_soil.getDefaultState());
			worldIn.playSoundEffect((double) ((float) pos.getX() + 0.5F), (double) ((float) pos.getY() + 0.5F),
			                        (double) ((float) pos.getZ() + 0.5F),
			                        MBlocks.virtian_soil.stepSound.getStepSound(),
			                        (MBlocks.virtian_soil.stepSound.getVolume() + 1.0F) / 2.0F,
			                        MBlocks.virtian_soil.stepSound.getFrequency() * 0.8F);
			return true;
		}
	}
	return false;
}
 
Example 9
Project: It-s-About-Time-Minecraft-Mod   File: ModItems.java   View source code 6 votes vote down vote up
public static void initializeItems(){
	
	timeToolMaterial = EnumHelper.addToolMaterial("timeToolMaterial", 6, 1620, 8.0F, 4.0F, 7);
	pheromoneArmor = EnumHelper.addArmorMaterial("pheromoneArmor", 12, new int[]{2, 4, 2, 1}, 9);

	fossil_Shard = new Item().setUnlocalizedName("iat.fossil_Shard").setTextureName("iat:fossil").setCreativeTab(ItsAboutTime.iatTab);
	rockPick = new ItemRockPick().setUnlocalizedName("iat.rockPick").setTextureName("iat:rockPick").setCreativeTab(ItsAboutTime.iatTab);
	fossil_Broken = new ItemFossilBroken().setUnlocalizedName("iat.fossil_Broken").setCreativeTab(ItsAboutTime.iatTab);
	fossil = new ItemFossil().setUnlocalizedName("iat.fossil").setCreativeTab(ItsAboutTime.iatTab);
	for (int i = 0; i < EnumFossilSkeleton.values().length; i++) {
		EnumFossilSkeleton.values()[i].fossilItem = new Item().setTextureName("iat:fossil").setUnlocalizedName("iat.fossil" + EnumFossilSkeleton.values()[i].name).setCreativeTab(ItsAboutTime.iatTab);
		EnumFossilSkeleton.values()[i].fossilBrokenItem = new Item().setTextureName("iat:fossil").setUnlocalizedName("iat.fossil_Broken" + EnumFossilSkeleton.values()[i].name).setCreativeTab(ItsAboutTime.iatTab);
	}
	amber = new ItemAmber().setUnlocalizedName("iat.amber").setCreativeTab(ItsAboutTime.iatTab);
	plaster_Ball = new Item().setUnlocalizedName("iat.plaster_Ball").setTextureName("iat:plaster").setCreativeTab(ItsAboutTime.iatTab);
	time_Crystal = new ItemTimeCrystal().setUnlocalizedName("iat.time_Crystal").setTextureName("iat:time_Crystal").setCreativeTab(ItsAboutTime.iatTab);
	time_Shovel = new ItemModSpade(timeToolMaterial).setUnlocalizedName("iat.time_Shovel").setTextureName("iat:time_Shovel").setCreativeTab(ItsAboutTime.iatTab);
	time_Pickaxe = new ItemModPickaxe(timeToolMaterial).setUnlocalizedName("iat.time_Pickaxe").setTextureName("iat:time_Pickaxe").setCreativeTab(ItsAboutTime.iatTab);
	time_Axe = new ItemModAxe(timeToolMaterial).setUnlocalizedName("iat.time_Axe").setTextureName("iat:time_Axe").setCreativeTab(ItsAboutTime.iatTab);
	time_Sword = new ItemSword(timeToolMaterial).setUnlocalizedName("iat.time_Sword").setTextureName("iat:time_Sword").setCreativeTab(ItsAboutTime.iatTab);
	time_Hoe = new ItemHoe(timeToolMaterial).setUnlocalizedName("iat.time_Hoe").setTextureName("iat:time_Hoe").setCreativeTab(ItsAboutTime.iatTab);
	pheromoneChest = new ItemPheromoneArmor(pheromoneArmor, 0, 1).setUnlocalizedName("iat.pheromoneCanester").setTextureName("iat:pheromoneCanester").setCreativeTab(ItsAboutTime.iatTab);
	bucket_Time = new ItemBucket(ModBlocks.fluidTimeBlock).setUnlocalizedName("iat.bucket_Time").setTextureName("iat:bucket_Time").setContainerItem(Items.bucket);
	ginkoNuts = new ItemFood(2, 0.2F, false).setPotionEffect(Potion.hunger.id, 30, 0, 0.3F).setUnlocalizedName("iat.ginkoNut").setTextureName("iat:ginko_nut").setCreativeTab(ItsAboutTime.iatTab);
}
 
Example 10
Project: TheDarkEra   File: TESmeltery.java   View source code 6 votes vote down vote up
public static int getItemBurnTime(ItemStack stack) {
	if (stack == null) {
		return 0;
	} else {
		Item item = stack.getItem();
		//If block
		if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) {
			Block block = Block.getBlockFromItem(item);
			if (block == Blocks.wooden_slab) return 150;
			if (block.getMaterial() == Material.wood) return 300;
			if (block == Blocks.coal_block) return 16000;
		}

           if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200;
           if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200;
           if (item instanceof ItemHoe && ((ItemHoe)item).getToolMaterialName().equals("WOOD")) return 200;
           if (item == Items.stick) return 100;
           if (item == Items.coal) return 1600;
           if (item == Items.lava_bucket) return 20000;
           if (item == Item.getItemFromBlock(Blocks.sapling)) return 100;
           if (item == Items.blaze_rod) return 2400;
           return GameRegistry.getFuelValue(stack);
	}
}
 
Example 11
Project: MerchantsTFC   File: ToolRackContainer.java   View source code 6 votes vote down vote up
@Override
protected boolean isItemValid(TileEntity tileEntity, ItemStack itemStack)
{
    Class<?> cls = tileEntity.getClass();
    
    if(cls != TEToolRack.class)
        return false;
    
    Item item = itemStack.getItem();
    
    return item instanceof ItemTool ||
        item instanceof ItemWeapon ||
        item instanceof ItemHoe ||
        item instanceof ItemProPick ||
        item instanceof ItemBow ||
        item instanceof ItemSword ||
        item instanceof ItemAxe ||
        item instanceof ItemSpade ||
        item instanceof ItemShears ||
        item instanceof ItemSpindle
        ;
}
 
Example 12
Project: RuneCraftery   File: TileEntityFurnace.java   View source code 6 votes vote down vote up
public static int func_70398_a(ItemStack p_70398_0_) {
   if(p_70398_0_ == null) {
      return 0;
   } else {
      int var1 = p_70398_0_.func_77973_b().field_77779_bT;
      Item var2 = p_70398_0_.func_77973_b();
      if(var1 < 256 && Block.field_71973_m[var1] != null) {
         Block var3 = Block.field_71973_m[var1];
         if(var3 == Block.field_72092_bO) {
            return 150;
         }

         if(var3.field_72018_cp == Material.field_76245_d) {
            return 300;
         }

         if(var3 == Block.field_111034_cE) {
            return 16000;
         }
      }

      return var2 instanceof ItemTool && ((ItemTool)var2).func_77861_e().equals("WOOD")?200:(var2 instanceof ItemSword && ((ItemSword)var2).func_77825_f().equals("WOOD")?200:(var2 instanceof ItemHoe && ((ItemHoe)var2).func_77842_f().equals("WOOD")?200:(var1 == Item.field_77669_D.field_77779_bT?100:(var1 == Item.field_77705_m.field_77779_bT?1600:(var1 == Item.field_77775_ay.field_77779_bT?20000:(var1 == Block.field_71987_y.field_71990_ca?100:(var1 == Item.field_77731_bo.field_77779_bT?2400:0)))))));
   }
}
 
Example 13
Project: IceAndShadow2   File: IaSRegistry.java   View source code 6 votes vote down vote up
public static void preInit() {
	for (final Object o : IceAndShadow2.getPreRegistrationHandlers()) {
		IaSRegistry.doAdd(o);
	}
	setPrimarilyTransfusionTarget(ItemArmor.class);
	setPrimarilyTransfusionTarget(ItemTool.class);
	setPrimarilyTransfusionTarget(ItemSword.class);
	setPrimarilyTransfusionTarget(ItemHoe.class);
	setPrimarilyTransfusionTarget(ItemShears.class);
	setPrimarilyTransfusionTarget(ItemFlintAndSteel.class);
	setPrimarilyTransfusionTarget(ItemBow.class);
	setPrimarilyTransfusionTarget(ItemFishingRod.class);
	setPrimarilyTransfusionTarget(IaSItemEchirArmorActive.class);
	setPrimarilyTransfusionTarget(IaSItemEchirKnifeActive.class);
	setPrimarilyTransfusionTarget(IaSItemEchirToolActive.class);
	setPrimarilyTransfusionTarget(IaSItemToolBroken.class);
	setPrimarilyTransfusionTarget(NyxBaseItemBow.class);
	setPrimarilyTransfusionTarget(NyxItemFlask.class);
	setPrimarilyTransfusionTarget(NyxItemSwordFrost.class);

	addGrenadeLogic(new NyxGrenadeExplosive());
	addGrenadeLogic(new NyxGrenadeIceWall());
	addGrenadeLogic(new NyxGrenadeShadow());
}
 
Example 14
Project: ProgressiveAutomation   File: ToolHelper.java   View source code 6 votes vote down vote up
public static int getType(ItemStack itemStack) {
	Item item = itemStack.getItem();
	if (item instanceof ItemPickaxe) {
		return TYPE_PICKAXE;
	} else if (item instanceof ItemAxe) {
		return TYPE_AXE;
	} else if (item instanceof ItemSpade) {
		return TYPE_SHOVEL;
	} else if (item instanceof ItemSword) {
		return TYPE_SWORD;
	} else if (item instanceof ItemHoe) {
		return TYPE_HOE;
	} else if (item instanceof ItemTool) {
		Set<String> toolClasses = ((ItemTool)item).getToolClasses(itemStack);
		if (toolClasses.contains("pickaxe")) return TYPE_PICKAXE;
		else if (toolClasses.contains("axe")) return TYPE_AXE;
		else if (toolClasses.contains("shovel")) return TYPE_SHOVEL;
		else if (toolClasses.contains("hoe")) return TYPE_HOE;
		else return -1;
	} else if (tinkersType(item)>=0) { //see if it's a tinkers type
		return tinkersType(item);
	} else {
		return -1;
	}
}
 
Example 15
Project: ProgressiveAutomation   File: ToolHelper.java   View source code 6 votes vote down vote up
public static int getLevel(ItemStack itemStack) {
	//Vanilla Tools
	if (itemStack.getItem() instanceof ItemTool) {
		return ((ItemTool)itemStack.getItem()).getToolMaterial().getHarvestLevel();
	} else if ((itemStack.getItem() instanceof ItemSword) ||
		(itemStack.getItem() instanceof ItemHoe)) {
		String material = "";
		if (itemStack.getItem() instanceof ItemSword) material = ((ItemSword)itemStack.getItem()).getToolMaterialName();
		else if (itemStack.getItem() instanceof ItemHoe) material = ((ItemHoe)itemStack.getItem()).getMaterialName();
		if (material.equals("WOOD")) return LEVEL_WOOD;
		else if (material.equals("STONE")) return LEVEL_STONE;
		else if (material.equals("IRON")) return LEVEL_IRON;
		else if (material.equals("GOLD")) return LEVEL_GOLD;
		else if (material.equals("EMERALD")) return LEVEL_DIAMOND;
		else if (material.equals("DIAMOND")) return LEVEL_DIAMOND;
	} else {
		//Tinkers Tools
		if (itemStack.hasTagCompound()) {
			return tinkersLevel(itemStack);
		}
	}

	return -1;
}
 
Example 16
Project: ProgressiveAutomation   File: ToolHelper.java   View source code 6 votes vote down vote up
public static boolean damageTool(ItemStack tool, World world, int x, int y, int z) {
	if ( (tool.getItem() instanceof ItemShears) || (tool.getItem() instanceof ItemTool) || 
			(tool.getItem() instanceof ItemHoe) || (tool.getItem() instanceof ItemSword) ) {
		if (tool.attemptDamageItem(1, RND)) {
			return true;
		}
	} else {
		Block mineBlock = world.getBlockState(new BlockPos(x, y, z)).getBlock();
		PlayerFake fakePlayer = new PlayerFake((WorldServer)world);
		if (tinkersType(tool.getItem())==TYPE_HOE) {
			tool.attemptDamageItem(1, RND);
		} else {
			tool.getItem().onBlockDestroyed(tool, world, mineBlock.getDefaultState(), new BlockPos(x, y, z), fakePlayer);
		}
		if (tinkersIsBroken(tool)) return true;
	}
	return false;
}
 
Example 17
Project: BetterChests   File: CropHandler.java   View source code 6 votes vote down vote up
static boolean makeFarmland(World world, BlockPos pos, IBetterChest chest, boolean simulate) {
	BlockPos below = pos.down();
	IBlockState blockBelow = world.getBlockState(below);
	boolean farmland = false;
	if (blockBelow.getBlock() == Blocks.DIRT || blockBelow.getBlock() == Blocks.GRASS) {
		int hoe = InvUtil.findInInvInternal(chest, null, test -> test.getItem() instanceof ItemHoe);
		if (hoe != -1) {
			farmland = true;
			if (!simulate) {
				ItemStack tool = chest.getStackInSlot(hoe);
				tool.attemptDamageItem(1, world.rand, null);
				if (tool.getItemDamage() > tool.getMaxDamage()) {
					tool.setItemDamage(0);
					tool.setCount(tool.getCount() - 1);
				}

				world.setBlockState(below, Blocks.FARMLAND.getDefaultState());
			}
		}
	}

	return farmland;
}
 
Example 18
Project: NeoCraft   File: TileEntitySteeper.java   View source code 6 votes vote down vote up
public static int getItemBurnTime(ItemStack fuel)
{
    if (fuel == null) { return 0; }
    else
    {
        int i = fuel.getItem().itemID;
        Item item = fuel.getItem();

        if (fuel.getItem() instanceof ItemBlock && Block.blocksList[i] != null)
        {
            Block block = Block.blocksList[i];
            if (block == Block.woodSingleSlab) { return 150; }
            if (block.blockMaterial == Material.wood) { return 300; }
        }

        if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemHoe && ((ItemHoe) item).getMaterialName().equals("WOOD")) return 200;
        if (i == Item.stick.itemID) return 100;
        if (i == Item.coal.itemID) return 1600;
        if (i == Item.bucketLava.itemID) return 20000;
        if (i == Block.sapling.blockID) return 100;
        if (i == Item.blazeRod.itemID) return 2400;
        return GameRegistry.getFuelValue(fuel);
    }
}
 
Example 19
Project: NeoCraft   File: TileEntityGeneratorSteam.java   View source code 6 votes vote down vote up
public static int getItemBurnTime(ItemStack fuel)
{
	int ret = 0;
    if (fuel == null) { return ret; }
    else
    {
        int i = fuel.getItem().itemID;
        Item item = fuel.getItem();
        if (fuel.getItem() instanceof ItemBlock && Block.blocksList[i] != null)
        {
            Block block = Block.blocksList[i];
            if (block == Block.woodSingleSlab) { ret = 150; }
            if (block.blockMaterial == Material.wood) { ret = 300; }
        }
        else if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) ret = 200;
        else if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) ret = 200;
        else if (item instanceof ItemHoe && ((ItemHoe) item).getMaterialName().equals("WOOD")) ret = 200;
        else if (i == Item.stick.itemID) ret = 100;
        else if (i == Item.coal.itemID) ret = 1600;
        else if (i == Item.bucketLava.itemID) ret = 20000;
        else if (i == Block.sapling.blockID) ret = 100;
        else if (i == Item.blazeRod.itemID) ret = 2400;
        else { ret = GameRegistry.getFuelValue(fuel); }
        return ret / 4;
    }
}
 
Example 20
Project: PlanterHelper   File: PlanterHelper.java   View source code 6 votes vote down vote up
@SuppressWarnings("UnusedDeclaration")
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
    HashMap<String, Integer> itemsList = new HashMap<String, Integer>();
    GameData.getItemRegistry().serializeInto(itemsList);
    for(String itemName : itemsList.keySet()) {
        String itemProperName = itemName.startsWith("\u0002") ? itemName.substring(1) : itemName;
        Item item = GameData.getItemRegistry().getObject(itemProperName);
        if(item != null && item instanceof ItemHoe) {
            OreDictionary.registerOre("hoe", new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE));
        }
    }

    /*
     * Misc Recipes
     */
    GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Blocks.farmland), Blocks.dirt, "hoe"));
}
 
Example 21
Project: DecompiledMinecraft   File: TileEntityFurnace.java   View source code 5 votes vote down vote up
/**
 * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
 * fuel
 */
public static int getItemBurnTime(ItemStack p_145952_0_)
{
    if (p_145952_0_ == null)
    {
        return 0;
    }
    else
    {
        Item item = p_145952_0_.getItem();

        if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air)
        {
            Block block = Block.getBlockFromItem(item);

            if (block == Blocks.wooden_slab)
            {
                return 150;
            }

            if (block.getMaterial() == Material.wood)
            {
                return 300;
            }

            if (block == Blocks.coal_block)
            {
                return 16000;
            }
        }

        return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0)))))));
    }
}
 
Example 22
Project: DecompiledMinecraft   File: TileEntityFurnace.java   View source code 5 votes vote down vote up
/**
 * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
 * fuel
 */
public static int getItemBurnTime(ItemStack p_145952_0_)
{
    if (p_145952_0_ == null)
    {
        return 0;
    }
    else
    {
        Item item = p_145952_0_.getItem();

        if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air)
        {
            Block block = Block.getBlockFromItem(item);

            if (block == Blocks.wooden_slab)
            {
                return 150;
            }

            if (block.getMaterial() == Material.wood)
            {
                return 300;
            }

            if (block == Blocks.coal_block)
            {
                return 16000;
            }
        }

        return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0)))))));
    }
}
 
Example 23
Project: BaseClient   File: TileEntityFurnace.java   View source code 5 votes vote down vote up
/**
 * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
 * fuel
 */
public static int getItemBurnTime(ItemStack p_145952_0_)
{
    if (p_145952_0_ == null)
    {
        return 0;
    }
    else
    {
        Item item = p_145952_0_.getItem();

        if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air)
        {
            Block block = Block.getBlockFromItem(item);

            if (block == Blocks.wooden_slab)
            {
                return 150;
            }

            if (block.getMaterial() == Material.wood)
            {
                return 300;
            }

            if (block == Blocks.coal_block)
            {
                return 16000;
            }
        }

        return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0)))))));
    }
}
 
Example 24
Project: BaseClient   File: TileEntityFurnace.java   View source code 5 votes vote down vote up
/**
 * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
 * fuel
 */
public static int getItemBurnTime(ItemStack p_145952_0_)
{
    if (p_145952_0_ == null)
    {
        return 0;
    }
    else
    {
        Item item = p_145952_0_.getItem();

        if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air)
        {
            Block block = Block.getBlockFromItem(item);

            if (block == Blocks.wooden_slab)
            {
                return 150;
            }

            if (block.getMaterial() == Material.wood)
            {
                return 300;
            }

            if (block == Blocks.coal_block)
            {
                return 16000;
            }
        }

        return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0)))))));
    }
}
 
Example 25
Project: Backmemed   File: TileEntityFurnace.java   View source code 5 votes vote down vote up
/**
 * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
 * fuel
 */
public static int getItemBurnTime(ItemStack stack)
{
    if (stack.func_190926_b())
    {
        return 0;
    }
    else
    {
        Item item = stack.getItem();
        return item == Item.getItemFromBlock(Blocks.WOODEN_SLAB) ? 150 : (item == Item.getItemFromBlock(Blocks.WOOL) ? 100 : (item == Item.getItemFromBlock(Blocks.CARPET) ? 67 : (item == Item.getItemFromBlock(Blocks.LADDER) ? 300 : (item == Item.getItemFromBlock(Blocks.WOODEN_BUTTON) ? 100 : (Block.getBlockFromItem(item).getDefaultState().getMaterial() == Material.WOOD ? 300 : (item == Item.getItemFromBlock(Blocks.COAL_BLOCK) ? 16000 : (item instanceof ItemTool && "WOOD".equals(((ItemTool)item).getToolMaterialName()) ? 200 : (item instanceof ItemSword && "WOOD".equals(((ItemSword)item).getToolMaterialName()) ? 200 : (item instanceof ItemHoe && "WOOD".equals(((ItemHoe)item).getMaterialName()) ? 200 : (item == Items.STICK ? 100 : (item != Items.BOW && item != Items.FISHING_ROD ? (item == Items.SIGN ? 200 : (item == Items.COAL ? 1600 : (item == Items.LAVA_BUCKET ? 20000 : (item != Item.getItemFromBlock(Blocks.SAPLING) && item != Items.BOWL ? (item == Items.BLAZE_ROD ? 2400 : (item instanceof ItemDoor && item != Items.IRON_DOOR ? 200 : (item instanceof ItemBoat ? 400 : 0))) : 100)))) : 300)))))))))));
    }
}
 
Example 26
Project: Mods   File: TileEntityAmmoFurnace.java   View source code 5 votes vote down vote up
/**
 * Returns the number of ticks that the supplied fuel item will keep the
 * furnace burning, or 0 if the item isn't fuel
 */
public static int getItemBurnTime(ItemStack stack) {
	if (stack.isEmpty())
		return 0;
	else {
		Item item = stack.getItem();

		if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR) {
			Block block = Block.getBlockFromItem(item);

			if (block == Blocks.WOODEN_SLAB)
				return 150;

			if (block.getDefaultState().getMaterial() == Material.WOOD)
				return 300;

			if (block == Blocks.COAL_BLOCK)
				return 16000;
		}

		if (item instanceof ItemTool && "WOOD".equals(((ItemTool) item).getToolMaterialName()))
			return 200;
		if (item instanceof ItemSword && "WOOD".equals(((ItemSword) item).getToolMaterialName()))
			return 200;
		if (item instanceof ItemHoe && "WOOD".equals(((ItemHoe) item).getMaterialName()))
			return 200;
		if (item == Items.STICK)
			return 100;
		if (item == Items.COAL)
			return 1600;
		if (item == Items.LAVA_BUCKET)
			return 20000;
		if (item == Item.getItemFromBlock(Blocks.SAPLING))
			return 100;
		if (item == Items.BLAZE_ROD)
			return 2400;
		return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(stack);
	}
}
 
Example 27
Project: CrystalMod   File: WorksiteCropFarm.java   View source code 5 votes vote down vote up
public boolean giveHoe(EntityMinionWorker worker) {
	if(worker.getHeldItemMainhand() == null){
		int[] slots = this.inventory.getRawIndices(RelativeSide.BOTTOM);
		for(int i = 0; i < slots.length; i++){
			int slot = slots[i];
			ItemStack hoe = inventory.getStackInSlot(slot);
			if(ItemStackTools.isValid(hoe) && hoe.getItem() instanceof ItemHoe && !ToolUtil.isEmptyRfTool(hoe) && !ToolUtil.isBrokenTinkerTool(hoe)){
				worker.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, hoe);
				this.inventory.setInventorySlotContents(slot, ItemStackTools.getEmptyStack());
				return true;
			}
		}
	}
	return false;
}
 
Example 28
Project: BIGB   File: AutoItemAndBlock.java   View source code 5 votes vote down vote up
/**
 * Creates a hoe from the specs provided.
 */
public static ItemHoe CreateHoe(ToolMaterial toolmaterial, CreativeTabs creativetab, int mininglevel, String texture, String unlocalizedname)
{
	ItemHoe hoe;
	hoe = new AutoHoe(toolmaterial, creativetab, mininglevel, texture, unlocalizedname);
	return hoe;
}
 
Example 29
Project: Mekfarm   File: CropFarmEntity.java   View source code 5 votes vote down vote up
@Override
protected boolean acceptsInputStack(int slot, ItemStack stack) {
    if (ItemStackUtil.isEmpty(stack))
        return true;

    // test for hoe
    if (stack.getItem() instanceof ItemHoe) {
        return true;
    }

    return PlantWrapperFactory.isFertilizer(stack) || PlantWrapperFactory.isSeed(stack);
}
 
Example 30
Project: Toms-Mod   File: CoreInit.java   View source code 5 votes vote down vote up
private static void nerfTool(Item tool) {
	try {
		if (tool instanceof ItemTool) {
			ReflectionHelper.setPrivateValue(ItemTool.class, (ItemTool) tool, null, "toolClass");// Remove tool class
			Field[] fields = ItemTool.class.getDeclaredFields();
			boolean s = false;
			for (Field f : fields) {
				f.setAccessible(true);
				Object o = f.get(tool);
				if (o instanceof Set) {
					TomsModUtils.setFinalField(f, tool, Sets.newHashSet());
					log.info("Hacked effectiveBlocks name: " + f.getName());
					s = true;
				} else if (o instanceof Float) {
					f.setFloat(tool, 1);
				}
			}
			if (!s)
				log.error("Did't find effectiveBlocks field");
			com.tom.handler.EventHandler.disabledItems.add(tool);
		} else if (tool instanceof ItemSword) {
			com.tom.handler.EventHandler.disabledItems.add(tool);
		} else if (tool instanceof ItemHoe) {
			com.tom.handler.EventHandler.disabledItems.add(tool);
		}
		proxy.runMethod((IClientMethod) () -> EventHandlerClient.addTooltipOverride(tool, "tomsMod.tooltip.nerfed", TextFormatting.RED));
		log.info("Successfully nerfed " + tool.getUnlocalizedName());
	} catch (Throwable e) {
		log.error("Unable to nerf " + tool.getUnlocalizedName() + " " + tool.getClass().getName(), e);
	}
}
 
Example 31
Project: Naschkatze   File: TileEntityNkGrinder.java   View source code 5 votes vote down vote up
/**
 * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
 * fuel
 * 
 * this makes grinder run on coal like furnace --secknv
 */
public static int getItemBurnTime(ItemStack stack) {
    if (stack == null) {
        return 0;
    }
    else {
        Item item = stack.getItem();

        if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR) {
            Block block = Block.getBlockFromItem(item);

            if (block == Blocks.WOODEN_SLAB) {
                return 150;
            }

            if (block.getDefaultState().getMaterial() == Material.WOOD) {
                return 300;
            }

            if (block == Blocks.COAL_BLOCK) {
                return 16000;
            }
        }

        if (item instanceof ItemTool && "WOOD".equals(((ItemTool)item).getToolMaterialName())) return 200;
        if (item instanceof ItemSword && "WOOD".equals(((ItemSword)item).getToolMaterialName())) return 200;
        if (item instanceof ItemHoe && "WOOD".equals(((ItemHoe)item).getMaterialName())) return 200;
        if (item == Items.STICK) return 100;
        if (item == Items.COAL) return 1600;
        if (item == Items.LAVA_BUCKET) return 20000;
        if (item == Item.getItemFromBlock(Blocks.SAPLING)) return 100;
        if (item == Items.BLAZE_ROD) return 2400;
        return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(stack);
    }
}
 
Example 32
Project: EnderCore   File: SpecialTooltipHandler.java   View source code 5 votes vote down vote up
public void addDurabilityTooltip(List<String> toolTip, ItemStack itemStack) {
  if (!itemStack.isItemStackDamageable()) {
    return;
  }
  Item item = itemStack.getItem();
  if (item instanceof ItemTool || item instanceof ItemArmor || item instanceof ItemSword || item instanceof ItemHoe || item instanceof ItemBow) {
    toolTip.add(ItemUtil.getDurabilityString(itemStack));
  }
}
 
Example 33
Project: FutureCraft   File: TileEntityAlloyFurnace.java   View source code 5 votes vote down vote up
/**
 * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
 * fuel
 */
public static int getItemBurnTime(ItemStack stack) {
    if (stack == null) {
        return 0;
    }
    else {
        Item item = stack.getItem();

        if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) {
            Block block = Block.getBlockFromItem(item);

            if (block == Blocks.wooden_slab) {
                return 150;
            }

            if (block.getMaterial() == Material.wood) {
                return 300;
            }

            if (block == Blocks.coal_block) {
                return 16000;
            }
        }

        if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200;
        if (item == Items.stick) return 100;
        if (item == Items.coal) return 1600;
        if (item == Items.lava_bucket) return 20000;
        if (item == Item.getItemFromBlock(Blocks.sapling)) return 100;
        if (item == Items.blaze_rod) return 2400;
        return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(stack);
    }
}
 
Example 34
Project: FutureCraft   File: TileEntityGenerator.java   View source code 5 votes vote down vote up
/**
 * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
 * fuel
 */
public static int getItemBurnTime(ItemStack stack) {
    if (stack == null) {
        return 0;
    }
    else {
        Item item = stack.getItem();

        if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) {
            Block block = Block.getBlockFromItem(item);

            if (block == Blocks.wooden_slab) {
                return 150;
            }

            if (block.getMaterial() == Material.wood) {
                return 300;
            }

            if (block == Blocks.coal_block) {
                return 16000;
            }
        }

        if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200;
        if (item == Items.stick) return 100;
        if (item == Items.coal) return 1600;
        if (item == Items.lava_bucket) return 20000;
        if (item == Item.getItemFromBlock(Blocks.sapling)) return 100;
        if (item == Items.blaze_rod) return 2400;
        return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(stack);
    }
}
 
Example 35
Project: Resilience-Client-Source   File: TileEntityFurnace.java   View source code 5 votes vote down vote up
public static int func_145952_a(ItemStack p_145952_0_)
{
    if (p_145952_0_ == null)
    {
        return 0;
    }
    else
    {
        Item var1 = p_145952_0_.getItem();

        if (var1 instanceof ItemBlock && Block.getBlockFromItem(var1) != Blocks.air)
        {
            Block var2 = Block.getBlockFromItem(var1);

            if (var2 == Blocks.wooden_slab)
            {
                return 150;
            }

            if (var2.getMaterial() == Material.wood)
            {
                return 300;
            }

            if (var2 == Blocks.coal_block)
            {
                return 16000;
            }
        }

        return var1 instanceof ItemTool && ((ItemTool)var1).getToolMaterialName().equals("WOOD") ? 200 : (var1 instanceof ItemSword && ((ItemSword)var1).func_150932_j().equals("WOOD") ? 200 : (var1 instanceof ItemHoe && ((ItemHoe)var1).getMaterialName().equals("WOOD") ? 200 : (var1 == Items.stick ? 100 : (var1 == Items.coal ? 1600 : (var1 == Items.lava_bucket ? 20000 : (var1 == Item.getItemFromBlock(Blocks.sapling) ? 100 : (var1 == Items.blaze_rod ? 2400 : 0)))))));
    }
}
 
Example 36
Project: MineFantasy   File: TileEntityFirepit.java   View source code 5 votes vote down vote up
/**
 * Gets the burn time
 * 
 * Wood tools and plank item are 1 minute
 * sticks and saplings are 30seconds
 */
public static int getItemBurnTime(ItemStack input)
   {
       if (input == null)
       {
           return 0;
       }
       else
       {
           int i = input.getItem().itemID;
           int d = input.getItemDamage();
           Item item = input.getItem();

           if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 3600;//3Mins
           if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 1800;//1.5Mins
           if (item instanceof ItemHoe && ((ItemHoe) item).getMaterialName().equals("WOOD")) return 2400;//2Mins
           if (i == Item.stick.itemID) return 600;//30Sec
           if (i == ItemListMF.plank.itemID) return 1200;//1Min
           
           if(i == ItemListMF.misc.itemID)
           {
           	if (d == ItemListMF.plankIronbark) return 1800;//1.5Mins
           	if (d == ItemListMF.plankEbony) return 3600;//3Mins
           }
           
           return 0;
       }
   }
 
Example 37
Project: MinExtension   File: HoeHelper.java   View source code 5 votes vote down vote up
public ItemHoe setNameAndTab(String name, CreativeTabs tab, Item material)
{
	this.setTextureName(ResourcePathHelper.getResourcesPath() + name);
	this.setUnlocalizedName(name);
	this.setCreativeTab(tab);
	this.material = material;
	return this;
}
 
Example 38
Project: SecurityCraft   File: TileEntityKeypadFurnace.java   View source code 5 votes vote down vote up
public static int getItemBurnTime(ItemStack p_145952_0_)
{
	if (p_145952_0_ == null)
		return 0;
	else
	{
		Item item = p_145952_0_.getItem();

		if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR)
		{
			Block block = Block.getBlockFromItem(item);

			if (block == Blocks.WOODEN_SLAB)
				return 150;

			if (block.getMaterial(block.getDefaultState()) == Material.WOOD)
				return 300;

			if (block == Blocks.COAL_BLOCK)
				return 16000;
		}

		if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200;
		if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200;
		if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200;
		if (item == Items.STICK) return 100;
		if (item == Items.COAL) return 1600;
		if (item == Items.LAVA_BUCKET) return 20000;
		if (item == Item.getItemFromBlock(Blocks.SAPLING)) return 100;
		if (item == Items.BLAZE_ROD) return 2400;
		return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_);
	}
}
 
Example 39
Project: SecurityCraft   File: TileEntityKeypadFurnace.java   View source code 5 votes vote down vote up
public static int getItemBurnTime(ItemStack p_145952_0_)
{
	if (p_145952_0_.isEmpty())
		return 0;
	else
	{
		Item item = p_145952_0_.getItem();

		if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR)
		{
			Block block = Block.getBlockFromItem(item);

			if (block == Blocks.WOODEN_SLAB)
				return 150;

			if (block.getMaterial(block.getDefaultState()) == Material.WOOD)
				return 300;

			if (block == Blocks.COAL_BLOCK)
				return 16000;
		}

		if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200;
		if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200;
		if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200;
		if (item == Items.STICK) return 100;
		if (item == Items.COAL) return 1600;
		if (item == Items.LAVA_BUCKET) return 20000;
		if (item == Item.getItemFromBlock(Blocks.SAPLING)) return 100;
		if (item == Items.BLAZE_ROD) return 2400;
		return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_);
	}
}
 
Example 40
Project: SecurityCraft   File: TileEntityKeypadFurnace.java   View source code 5 votes vote down vote up
public static int getItemBurnTime(ItemStack p_145952_0_)
{
	if (p_145952_0_ == null)
		return 0;
	else
	{
		Item item = p_145952_0_.getItem();

		if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air)
		{
			Block block = Block.getBlockFromItem(item);

			if (block == Blocks.wooden_slab)
				return 150;

			if (block.getMaterial() == Material.wood)
				return 300;

			if (block == Blocks.coal_block)
				return 16000;
		}

		if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200;
		if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200;
		if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200;
		if (item == Items.stick) return 100;
		if (item == Items.coal) return 1600;
		if (item == Items.lava_bucket) return 20000;
		if (item == Item.getItemFromBlock(Blocks.sapling)) return 100;
		if (item == Items.blaze_rod) return 2400;
		return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_);
	}
}