当前位置: 首页>>代码示例>>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;未经允许,请勿转载。