本文整理汇总了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;
}
}
示例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);
}
}
}
示例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;
}
}
}
}
}
}
}
示例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;
}
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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));
}
}
示例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;
}
}
示例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";
}
示例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;
}
示例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;
}
示例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;
}