本文整理匯總了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;
}
示例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;
}
示例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;
}
}
}
示例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);
}
}
}
示例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;
}
示例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
;
}
示例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;
}
}
示例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";
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}