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


Java ItemAxe類代碼示例

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


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

示例1: CheckItemInHand

import net.minecraft.item.ItemAxe; //導入依賴的package包/類
protected boolean CheckItemInHand(EntityPlayer entityPlayer) {

        if (entityPlayer.getHeldItemMainhand().isEmpty()) {
            return false;
        }

        if (ConfigurationHandler.axeTypes.contains(entityPlayer.getHeldItemMainhand().getItem().getUnlocalizedName())) {
            return true;
        }

        boolean test;

        try {
            ItemAxe tmp = (ItemAxe) entityPlayer.getHeldItemMainhand().getItem();
            test = true;
        } catch (Exception e) {
            test = false;
        }

        return test;
    }
 
開發者ID:DuchLord,項目名稱:TreeChopper,代碼行數:22,代碼來源:CommonProxy.java

示例2: getRemainingItems

import net.minecraft.item.ItemAxe; //導入依賴的package包/類
@Override
public ItemStack[] getRemainingItems(InventoryCrafting inventoryCrafting) {
    final ItemStack[] remainingItems = new ItemStack[inventoryCrafting.getSizeInventory()];

    for (int i = 0; i < remainingItems.length; ++i) {
        final ItemStack itemstack = inventoryCrafting.getStackInSlot(i);

        if (itemstack != null && itemstack.getItem() instanceof ItemAxe) {
            remainingItems[i] = damageAxe(itemstack.copy());
        } else {
            remainingItems[i] = ForgeHooks.getContainerItem(itemstack);
        }
    }

    return remainingItems;
}
 
開發者ID:droidicus,項目名稱:AquaRegia,代碼行數:17,代碼來源:ShapelessCuttingRecipe.java

示例3: PopulateAxe

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

示例4: addVanillaTools

import net.minecraft.item.ItemAxe; //導入依賴的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

示例5: getToolClassFromNode

import net.minecraft.item.ItemAxe; //導入依賴的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

示例6: isItemValid

import net.minecraft.item.ItemAxe; //導入依賴的package包/類
@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
        ;
}
 
開發者ID:Aleksey-Terzi,項目名稱:MerchantsTFC,代碼行數:23,代碼來源:ToolRackContainer.java

示例7: getType

import net.minecraft.item.ItemAxe; //導入依賴的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

示例8: identityType

import net.minecraft.item.ItemAxe; //導入依賴的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

示例9: isHoldingWeapon

import net.minecraft.item.ItemAxe; //導入依賴的package包/類
public static boolean isHoldingWeapon() {
    if (thePlayer().func_70694_bm() != null && (thePlayer().func_70694_bm().func_77973_b() instanceof ItemSword
            || thePlayer().func_70694_bm().func_77973_b() instanceof ItemAxe))
        return true;

    return false;
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:8,代碼來源:Wrapper.java

示例10: func_190629_c

import net.minecraft.item.ItemAxe; //導入依賴的package包/類
protected void func_190629_c(EntityLivingBase p_190629_1_)
{
    super.func_190629_c(p_190629_1_);

    if (p_190629_1_.getHeldItemMainhand().getItem() instanceof ItemAxe)
    {
        this.func_190777_m(true);
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:10,代碼來源:EntityPlayer.java

示例11: getPlayerRelativeBlockHardness

import net.minecraft.item.ItemAxe; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos)
{
	// Axes are hardcoded to break blocks with a material of PLANT at their efficiency speed, need to fix that.
	ItemStack stack = player.getHeldItemMainhand();
	return !stack.isEmpty() && stack.getItem() instanceof ItemAxe ? super.getPlayerRelativeBlockHardness(state, player, worldIn, pos) / stack.getItem().getStrVsBlock(stack, state) : super.getPlayerRelativeBlockHardness(state, player, worldIn, pos);
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:9,代碼來源:BlockCrop.java

示例12: isSuitableWeapon

import net.minecraft.item.ItemAxe; //導入依賴的package包/類
private boolean isSuitableWeapon(ItemStack stack)
{
    if(stack.isEmpty()) return false;

    Item item = stack.getItem();
    return item.getToolClasses(stack).contains("axe") || item instanceof ItemSword || item instanceof ItemAxe;
}
 
開發者ID:DaedalusGame,項目名稱:BetterWithAddons,代碼行數:8,代碼來源:ButcherHandler.java

示例13: handleSuccessfulAttack

import net.minecraft.item.ItemAxe; //導入依賴的package包/類
protected void handleSuccessfulAttack(Entity entityIn, int knockback) {
	if (knockback > 0 && entityIn instanceof EntityLivingBase) {
		((EntityLivingBase) entityIn).knockBack(this, (float) knockback * 0.5F, (double) MathHelper.sin(this.rotationYaw * 0.017453292F), (double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
		this.motionX *= 0.6D;
		this.motionZ *= 0.6D;
	}

	int j = EnchantmentHelper.getFireAspectModifier(this);

	if (j > 0) {
		entityIn.setFire(j * 4);
	}

	if (entityIn instanceof EntityPlayer) {
		EntityPlayer entityplayer = (EntityPlayer) entityIn;
		ItemStack itemstack = this.getHeldItemMainhand();
		ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : null;

		if (itemstack != null && itemstack1 != null && itemstack.getItem() instanceof ItemAxe && itemstack1.getItem() == Items.SHIELD) {
			float f1 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;

			if (this.rand.nextFloat() < f1) {
				entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
				this.world.setEntityState(entityplayer, (byte) 30);
			}
		}
	}

	this.applyEnchantments(this, entityIn);
}
 
開發者ID:ToroCraft,項目名稱:ToroQuest,代碼行數:31,代碼來源:EntityToroNpc.java

示例14: CreateAxe

import net.minecraft.item.ItemAxe; //導入依賴的package包/類
/**
 * Creates a axe from the specs provided.
 */
public static ItemAxe CreateAxe(ToolMaterial toolmaterial, float EfficiencyOnProperMaterial, CreativeTabs creativetab, int mininglevel, String texture, String unlocalizedname)
{
	ItemAxe axe;
	axe = new AutoAxe(toolmaterial, EfficiencyOnProperMaterial, creativetab, mininglevel, texture, unlocalizedname);
	return axe;
}
 
開發者ID:SneakyTactician,項目名稱:BIGB,代碼行數:10,代碼來源:AutoItemAndBlock.java

示例15: doTheZorroThing

import net.minecraft.item.ItemAxe; //導入依賴的package包/類
@SubscribeEvent
public void doTheZorroThing(EntityInteractEvent event) {
    EntityPlayer player = event.entityPlayer;
    if (player.worldObj.isRemote) return;
    if (player.isRiding()) return;
    if (!(event.target instanceof EntityHorse)) return;
    EntityHorse horse = (EntityHorse) event.target;
    if (player.fallDistance <= 2) return;
    if (!horse.isHorseSaddled()) return;
    if (horse.getLeashed()) {
        if (!(horse.getLeashedToEntity() instanceof EntityLeashKnot)) return;
        horse.getLeashedToEntity().interactFirst(player);
    }
    boolean awesome = false;
    if (player.fallDistance > 5 && player.getHeldItem() != null) {
        Item held = player.getHeldItem().getItem();
        boolean has_baby = false;
        if (player.riddenByEntity instanceof EntityAgeable) {
            EntityAgeable ea = (EntityAgeable) player.riddenByEntity;
            has_baby = ea.isChild();
        }
        awesome = held instanceof ItemSword || held instanceof ItemAxe || held instanceof ItemBow || player.riddenByEntity instanceof EntityPlayer || has_baby;
    }
    if (awesome) {
        horse.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 40, 2, false, false));
        horse.addPotionEffect(new PotionEffect(Potion.resistance.id, 20 * 40, 1, true, true));
        horse.addPotionEffect(new PotionEffect(Potion.jump.id, 20 * 40, 1, true, true));
    } else {
        horse.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 8, 1, false, false));
    }
    horse.playLivingSound();
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:33,代碼來源:MiscellaneousNonsense.java


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