當前位置: 首頁>>代碼示例>>Java>>正文


Java ItemPickaxe類代碼示例

本文整理匯總了Java中net.minecraft.item.ItemPickaxe的典型用法代碼示例。如果您正苦於以下問題:Java ItemPickaxe類的具體用法?Java ItemPickaxe怎麽用?Java ItemPickaxe使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ItemPickaxe類屬於net.minecraft.item包,在下文中一共展示了ItemPickaxe類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: removedByPlayer

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
@Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
{
    ItemStack currentStack = player.getCurrentEquippedItem();
	if (currentStack != null && currentStack.getItem() instanceof ItemPickaxe)
 {
     return world.setBlockToAir(x, y, z);
 }
 else if (player.capabilities.isCreativeMode)
 {
     return world.setBlockToAir(x, y, z);
 }
 else 
 {
 	beginHatch(world, x, y, z, player);
 	return false;
 }
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:19,代碼來源:BlockSlimelingEgg.java

示例2: harvestBlock

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
@Override
public void harvestBlock(World world, EntityPlayer par2EntityPlayer, int x, int y, int z, int par6)
{
    ItemStack currentStack = par2EntityPlayer.getCurrentEquippedItem();

    if (currentStack != null && currentStack.getItem() instanceof ItemPickaxe)
    {
        par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
        par2EntityPlayer.addExhaustion(0.025F);
        this.dropBlockAsItem(world, x, y, z, par6 % 3, 0);
        if (currentStack.getItem() == MarsItems.deshPickaxe && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer))
        {
            ItemStack itemstack = new ItemStack(MarsItems.deshPickSlime, 1, currentStack.getItemDamage());
            if (currentStack.stackTagCompound != null)
            {
                itemstack.stackTagCompound = (NBTTagCompound) currentStack.stackTagCompound.copy();
            }
            par2EntityPlayer.setCurrentItemOrArmor(0, itemstack);
        }
    }
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:22,代碼來源:BlockSlimelingEgg.java

示例3: onRenderTick

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent event) {
	EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().thePlayer;
	if (player != null) {
		if (player.getHeldItemMainhand() != null && player.getHeldItemMainhand().toString().contains("tile.air")) {
			ItemStack held = player.getHeldItemMainhand();
			InventoryPlayer playerInv = player.inventory;
			if (held.getItem() instanceof ItemPickaxe) {
				if(held.serializeNBT().getInteger("BurnTimeLeft") == 0){
					for (int i = 0; i < playerInv.getSizeInventory(); i++) {
						if (playerInv.getStackInSlot(i).getItem() == Items.COAL) {
							held.serializeNBT().setInteger("BurnTimeLeft",
									TileEntityFurnace.getItemBurnTime(playerInv.getStackInSlot(i)));
							break;
						}
					}						
				}
			}
		}
	}
}
 
開發者ID:GummyBlasian,項目名稱:Inventory-Power,代碼行數:22,代碼來源:AutoOreSmeltingEvent.java

示例4: PopulatePickaxe

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
/**
 * Finds or creates a pickaxe for an ore.
 */
public static void PopulatePickaxe(OreStuff stuff)
{
	if (!stuff.HasPickaxe)
	{
		Item Pickaxe = Util.FindItemFromString(stuff.BaseName + "pick");
		
		if (Pickaxe != null)
		{
			stuff.HasPickaxe = true;
		}
		else
		{
			ItemPickaxe pick;
			pick = AutoItemAndBlock.CreatePickaxe(stuff.MetalMaterial, Util.rand.nextInt(10), 1, ModTabs.maintab, stuff.MetalMaterial.getHarvestLevel(), Reference.MODID + ":MissingPickaxeTexture", stuff.BaseName + "Pickaxe");
			stuff.Pickaxe = pick;
		}
	}
}
 
開發者ID:SneakyTactician,項目名稱:BIGB,代碼行數:22,代碼來源:AutoCreateForOres.java

示例5: addVanillaTools

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
@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);
		}
	}
}
 
開發者ID:Elix-x,項目名稱:toolscompressor,代碼行數:23,代碼來源:ScanningForToolsEvent.java

示例6: getToolClassFromNode

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
/**
 * switches through input number to determine desired tool
 * 
 * @param tool
 * @return
 */
public static Class getToolClassFromNode(Node tool)
{
	if (tool != null)
	{
		if (tool.getNodeType() == Node.ELEMENT_NODE)
		{
			int toolIndex = 0;
			Element toolElement = (Element) tool;
			toolIndex = Integer.parseInt(toolElement.getTextContent());

			switch (toolIndex)
			{
				case 0:
					return CuttingKnifeBase.class;
				case 1:
					return ItemAxe.class;
				case 2:
					return ItemPickaxe.class;
				case 3:
					return ItemSpade.class;
			}
		}
	}
	return CuttingKnifeBase.class;
}
 
開發者ID:VapourDrive,項目名稱:HarderStart,代碼行數:32,代碼來源:CuttingTableRecipeParser.java

示例7: isItemValid

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
@Override
public boolean isItemValid( ItemStack stack )
{
	if ( stack == null )
	{
		return true;
	}
	
	
	Item item = stack.getItem();
	if ( item instanceof ItemPickaxe || item == ComponentEquipment.items.pickaxe )
	{
		return true;
	}
	
	return false;
}
 
開發者ID:spacechase0,項目名稱:ComponentEquipment,代碼行數:18,代碼來源:PickaxeSlot.java

示例8: attackEntityFrom

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
public boolean attackEntityFrom(DamageSource damagesource, float f) {
	Entity entity = damagesource.getTrueSource();
	if (entity != null) {
		if (entity instanceof EntityPlayer) {
			ItemStack stack = ((EntityPlayer) entity).inventory.getCurrentItem();
			if (stack != null) {
				if (stack.getItem() == FakeOres.antiOresBlade) {
					f = Float.MAX_VALUE;
				}
				if (stack.getItem() instanceof ItemPickaxe) {
					f = (f * 5);
				}
			}
		}
	}
	if (damagesource.isFireDamage()) {
		return false;
	}
	if (damagesource.isExplosion()) {
		f = Float.MAX_VALUE;
		return true;
	}
	return super.attackEntityFrom(damagesource, f);
}
 
開發者ID:elias54,項目名稱:Fake-Ores-2,代碼行數:25,代碼來源:EntityCoalOre.java

示例9: matches

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
@Override
public boolean matches(InventoryCrafting crafting, World world) {
    boolean pickFound = false;
    boolean gemFound = false;
    boolean somethingElseFound = false;

    for(int i = 0; i < crafting.getSizeInventory(); i++){
        if(crafting.getStackInSlot(i) != null) {   //if there's an item
            ItemStack stack = crafting.getStackInSlot(i);

            if (stack.getItem() instanceof ItemPickaxe && !somethingElseFound){ //check if it's a valid pickaxe
                if(stack.getItem().getHarvestLevel(stack, "pickaxe") >= 2){
                    if(stack.getItemDamage() < stack.getMaxDamage() - 7){
                        pickFound = true;
                    }
                }
            }else if(OreHelper.isItemThisOre(stack, ore) && !somethingElseFound){ //check if it's a gem
                gemFound = true;
            }else{
                somethingElseFound = true;
            }
        }
    }

    return pickFound && gemFound && !somethingElseFound;
}
 
開發者ID:goldenapple3,項目名稱:Marble,代碼行數:27,代碼來源:DustCrushingRecipe.java

示例10: onBlockClicked

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
@Override
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
	if (world.isRemote) {
		return;
	}
	if (PlayerUtils.isSword(player.getHeldItem())) {
		long time = world.getWorldTime();
		long days = (world.getTotalWorldTime() / 24000L);
		long current = (time + 6000L) % 24000L; // 0 is 6:00 am, 18000 is midnight, so add 6000
		int h = (int)(current / 1000L);
		int m = (int)((current % 1000L) * 3 / 50); // 1000 ticks divided by 60 minutes = 16 and 2/3
		PlayerUtils.sendTranslatedChat(player, "chat.zss.block.gossip_stone.time", String.format("%02d", h), String.format("%02d", m), days);
	} else if (world.getBlockState(pos).getValue(UNBREAKABLE).booleanValue() && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemPickaxe) {
		world.playSoundAtEntity(player, Sounds.ITEM_BREAK, 0.25F, 1.0F / (world.rand.nextFloat() * 0.4F + 0.5F));
	}
}
 
開發者ID:coolAlias,項目名稱:ZeldaSwordSkills,代碼行數:17,代碼來源:BlockGossipStone.java

示例11: getType

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
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;
	}
}
 
開發者ID:Vanhal,項目名稱:ProgressiveAutomation,代碼行數:26,代碼來源:ToolHelper.java

示例12: identityType

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
private static String identityType(@Nonnull ItemStack stack) {
	Item item = stack.getItem();
	if (item instanceof ItemArmor) {
		switch (((ItemArmor)item).armorType) {
			case HEAD:
				return "helmet";
			case CHEST:
				return "chestplate";
			case LEGS:
				return "leggings";
			case FEET:
				return "boots";
			default:
				break;
		}
	} else if (item instanceof ItemPickaxe) return "pickaxe";
	else if (item instanceof ItemShears) return "shears";
	else if (item instanceof ItemAxe) return "axe";
	else if (item instanceof ItemSpade) return "shovel";
	else if (item instanceof ItemBlock) return "block";
	else if (item instanceof ItemBucket) return "bucket";

	return "gizmo";
}
 
開發者ID:OpenMods,項目名稱:OpenBlocks,代碼行數:25,代碼來源:LoreFlimFlam.java

示例13: CreatePickaxe

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
/**
 * Creates a pickaxe from the specs provided.
 */
public static ItemPickaxe CreatePickaxe(ToolMaterial material, float EfficiencyOnProperMaterial, int maxStackSize, CreativeTabs creativetab, int mininglevel, String texturename, String UnlocalizedName)
{
	ItemPickaxe pick;
	pick = new AutoPickaxe(material, EfficiencyOnProperMaterial, maxStackSize, creativetab, mininglevel, texturename, UnlocalizedName);
	return pick;
}
 
開發者ID:SneakyTactician,項目名稱:BIGB,代碼行數:10,代碼來源:AutoItemAndBlock.java

示例14: ItemDrill

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
public ItemDrill(ToolMaterial toolMaterial) {
    super(0, toolMaterial);
    setNoRepair();

    addToolClass("pickaxe");

    effectiveBlocks.addAll(ItemPickaxe.field_150915_c);
    effectiveMaterials.add(Material.iron);
    effectiveMaterials.add(Material.anvil);
    effectiveMaterials.add(Material.rock);

    maxEnergy = Config.maxEnergy;
    energyPerUse = Config.energyPerUse;
}
 
開發者ID:Nentify,項目名稱:Drillify,代碼行數:15,代碼來源:ItemDrill.java

示例15: onBlockActivated

import net.minecraft.item.ItemPickaxe; //導入依賴的package包/類
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
	if (state.getValue(AGE) == 5)
	{
		if (worldIn.isRemote)
			return true;
		if (playerIn.getHeldItem() != null)
		{
			if (playerIn.getHeldItem().getItem() instanceof ItemPickaxe)
			{
				worldIn.setBlockState(pos, this.getDefaultState(), 2);
				EntityItem ei = new EntityItem(worldIn, playerIn.posX, playerIn.posY, playerIn.posZ,
				                               new ItemStack(this.item));
				worldIn.spawnEntityInWorld(ei);
				playerIn.getHeldItem().damageItem(2, playerIn);
				playerIn.addStat(MAchievements.glacieric_ice, 1);
				if (playerIn instanceof FakePlayer)
				{
					ei.onCollideWithPlayer(playerIn);
				}
				return true;
			}
		}
	}
	return false;
}
 
開發者ID:MinestrapTeam,項目名稱:Minestrappolation-4,代碼行數:28,代碼來源:BlockIceDeposit.java


注:本文中的net.minecraft.item.ItemPickaxe類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。