当前位置: 首页>>代码示例>>Java>>正文


Java ItemSpade类代码示例

本文整理汇总了Java中net.minecraft.item.ItemSpade的典型用法代码示例。如果您正苦于以下问题:Java ItemSpade类的具体用法?Java ItemSpade怎么用?Java ItemSpade使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ItemSpade类属于net.minecraft.item包,在下文中一共展示了ItemSpade类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyBackers

import net.minecraft.item.ItemSpade; //导入依赖的package包/类
public static void applyBackers(List<MaterialDefinition> definitions) {
    for (MaterialDefinition definition : definitions) {
        ToolMaterial toolMaterial = definition.getToolMaterial();
        ArmorMaterial armorMaterial = definition.getArmorMaterial();

        RandoresItemData itemData = definition.getData();

        RandoresItems.hoe.registerBacker(itemData, new ItemHoe(toolMaterial));
        RandoresItems.sword.registerBacker(itemData, new ItemSword(toolMaterial));
        RandoresItems.axe.registerBacker(itemData, new ConstructableAxe(toolMaterial, toolMaterial.getDamageVsEntity() + 5f, -3f));
        RandoresItems.shovel.registerBacker(itemData, new ItemSpade(toolMaterial));
        RandoresItems.pickaxe.registerBacker(itemData, new ConstructablePickaxe(toolMaterial));
        RandoresItems.battleaxe.registerBacker(itemData, new ConstructableAxe(toolMaterial, toolMaterial.getDamageVsEntity() + 8f, -3.5f));
        RandoresItems.helmet.registerBacker(itemData, armorMaterial);
        RandoresItems.chestplate.registerBacker(itemData, armorMaterial);
        RandoresItems.leggings.registerBacker(itemData, armorMaterial);
        RandoresItems.boots.registerBacker(itemData, armorMaterial);
    }
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:20,代码来源:MaterialDefinitionGenerator.java

示例2: onPlayerInteract

import net.minecraft.item.ItemSpade; //导入依赖的package包/类
public static void onPlayerInteract(PlayerInteractEvent event) {
	if (EtFuturum.enableGrassPath)
		if (event.entityPlayer != null) {
			World world = event.entityPlayer.worldObj;
			if (event.action == Action.RIGHT_CLICK_BLOCK)
				if (world.getBlock(event.x, event.y, event.z) == Blocks.grass) {
					ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
					if (stack != null && (stack.getItem() instanceof ItemSpade || isTinkersShovel(stack))) {
						world.setBlock(event.x, event.y, event.z, ModBlocks.grass_path);
						event.entityPlayer.swingItem();
						stack.damageItem(1, event.entityPlayer);
						world.playSoundEffect(event.x + 0.5F, event.y + 0.5F, event.z + 0.5F, Block.soundTypeGravel.getStepResourcePath(), 1.0F, 0.8F);
					}
				}
		}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:17,代码来源:GrassPath.java

示例3: PopulateShovel

import net.minecraft.item.ItemSpade; //导入依赖的package包/类
/**
 * Finds or creates a shovel for an ore.
 */
public static void PopulateShovel(OreStuff stuff)
{
	if (!stuff.HasShovel)
	{
		Item Shovel = Util.FindItemFromString(stuff.BaseName + "shovel");
		
		if (Shovel != null)
		{
			stuff.HasShovel = true;
		}
		else
		{
			ItemSpade shovel;
			shovel = AutoItemAndBlock.CreateShovel(stuff.MetalMaterial, ModTabs.maintab, stuff.MetalMaterial.getHarvestLevel(), Reference.MODID + ":MissingShovelTexture", stuff.BaseName + "Shovel");
			stuff.Shovel = shovel;
		}
	}
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:22,代码来源:AutoCreateForOres.java

示例4: addVanillaTools

import net.minecraft.item.ItemSpade; //导入依赖的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.ItemSpade; //导入依赖的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.ItemSpade; //导入依赖的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.ItemSpade; //导入依赖的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.ItemSpade; //导入依赖的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: onRightClickBlock

import net.minecraft.item.ItemSpade; //导入依赖的package包/类
@SubscribeEvent
public static void onRightClickBlock(PlayerInteractEvent.RightClickBlock event) {
    EntityPlayer player = event.getEntityPlayer();
    World world = event.getWorld();
    BlockPos pos = event.getPos();
    EnumFacing face = event.getFace();
    ItemStack stack = event.getItemStack();
    Item item = stack.getItem();

    if (item instanceof ItemSpade) {
        if (player.canPlayerEdit(pos.offset(face), face, stack)) {
            IBlockState state = world.getBlockState(pos);
            Block block = state.getBlock();

            if (face != EnumFacing.DOWN && world.isAirBlock(pos.up()) && block == GenesisBlocks.HUMUS) {
                world.playSound(player, pos, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundCategory.BLOCKS, 1.0F, 1.0F);

                if (!world.isRemote) {
                    IBlockState path = GenesisBlocks.HUMUS_PATH.getDefaultState();
                    world.setBlockState(pos, path, WorldFlags.UPDATE_BLOCK_AND_CLIENT_AND_RERENDER_ON_MAIN);
                    stack.damageItem(1, player);
                }

                event.setCanceled(true);
            }
        }
    }
}
 
开发者ID:Boethie,项目名称:Genesis,代码行数:29,代码来源:GenesisEventHandler.java

示例10: CreateShovel

import net.minecraft.item.ItemSpade; //导入依赖的package包/类
/**
 * Creates a shovel from the specs provided.
 */
public static ItemSpade CreateShovel(ToolMaterial toolmaterial, CreativeTabs creative, int mininglevel, String Texture, String UnlocalizedName)
{
	ItemSpade shovel;
	shovel = new AutoSpade(toolmaterial, creative, mininglevel, Texture, UnlocalizedName);
	return shovel;
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:10,代码来源:AutoItemAndBlock.java

示例11: damageEntity

import net.minecraft.item.ItemSpade; //导入依赖的package包/类
@Override
protected void damageEntity(DamageSource src, float amount){
	String type = String.valueOf(src == null ? null : src.getDamageType()); // null protection
	if(src instanceof EntityDamageSource && src.getEntity() instanceof EntityPlayer){
		EntityPlayer player = (EntityPlayer)src.getEntity();
		ItemStack item = player.getHeldItem(EnumHand.MAIN_HAND);
		if(item != null) {
			if (item.getItem() instanceof ItemSpade || item.getItem().getToolClasses(item).contains("shovel")) {
				this.kill();
			}
		}
	}
	if(type.equals(DamageSource.outOfWorld.getDamageType())) {
		super.damageEntity(src,amount); // kill command and falling out of the world
		return;
	}

	if(type.equals(DamageSource.inWall.getDamageType())){
		this.jumpOutOfWall();
	}

	// damage handling
	if(LootableBodies.completelyInvulnerable) return;

	if(src instanceof EntityDamageSource ){
		if(LootableBodies.hurtByAttacks) super.damageEntity(src,amount);
		return;
	}

	if(matchesAny(type, DamageSource.anvil, DamageSource.cactus, DamageSource.fall, DamageSource.fallingBlock, DamageSource.flyIntoWall, DamageSource.inFire, DamageSource.lava, DamageSource.magic, DamageSource.lightningBolt, DamageSource.onFire)){
		if(LootableBodies.hurtByEnvironment)super.damageEntity(src,amount);
		return;
	}

	if(LootableBodies.hurtByMisc){
		super.damageEntity(src,amount);
		return;
	}
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:LootableBodies,代码行数:40,代码来源:EntityLootableBody.java

示例12: setNameAndTab

import net.minecraft.item.ItemSpade; //导入依赖的package包/类
public ItemSpade setNameAndTab(String name, CreativeTabs tab, Item material)
{
	this.setTextureName(ResourcePathHelper.getResourcesPath() + name);
	this.setUnlocalizedName(name);
	this.setCreativeTab(tab);
	this.material = material;
	return this;
}
 
开发者ID:AlphaSwittle-Team,项目名称:MinExtension,代码行数:9,代码来源:SpadeHelper.java

示例13: setNameAndTab

import net.minecraft.item.ItemSpade; //导入依赖的package包/类
public ItemSpade setNameAndTab(String name, CreativeTabs tab)
{
	this.setTextureName(ResourcePathHelper.getResourcesPath() + name);
	this.setUnlocalizedName(name);
	this.setCreativeTab(tab);
	return this;
}
 
开发者ID:AlphaSwittle-Team,项目名称:AnimalWarriors,代码行数:8,代码来源:SpadeHelper.java

示例14: getColoredVersion

import net.minecraft.item.ItemSpade; //导入依赖的package包/类
public static Item getColoredVersion(Item tool) {
	
	if (tool instanceof ItemPickaxe || tool instanceof ModPickaxe) {
		return ModItems.colored_pickaxe;
	} else if (tool instanceof ItemSpade || tool instanceof ModShovel) {
		return ModItems.colored_shovel;
	} else if (tool instanceof ItemAxe || tool instanceof ModAxe) {
		return ModItems.colored_axe;
	} else if (tool instanceof ItemHoe || tool instanceof ModHoe) {
		return ModItems.colored_hoe;
	} else if (tool instanceof Hammer) {
		return ModItems.colored_hammer;
	} else if (tool instanceof Trident) {
		Trident trident = (Trident) tool;
		switch (trident.HeadMaterial) {
		case EMERALD:
			return ModItems.diamond_colored_trident;
		case GOLD:
			return ModItems.gold_colored_trident;
		case IRON:
			return ModItems.iron_colored_trident;
		case STONE:
			return ModItems.stone_colored_trident;
		case WOOD:
			return ModItems.wood_colored_trident;
		default:
			return ModItems.colored_colored_trident;
		}
	} else if (tool instanceof ItemSword || tool instanceof ModSword) {
		return ModItems.colored_sword;
	}
	return null;
	
}
 
开发者ID:penguinsfan77,项目名称:VanillaImp,代码行数:35,代码来源:ItemHelper.java

示例15: ToolShovel

import net.minecraft.item.ItemSpade; //导入依赖的package包/类
public ToolShovel() {
	super();

	this.vanillaEquivalent = new ItemSpade(ToolMaterial.EMERALD) {
	};
	this.vanillaEquivalent.setUnlocalizedName("shovelDiamond")
			.setTextureName("diamond_shovel");
	GameRegistry.registerItem(this.vanillaEquivalent, "dummy_shovel");

	this.allowedEnchants.add(EnumEnchantmentType.digger);
	this.allowedEnchants.remove(EnumEnchantmentType.weapon);
}
 
开发者ID:Katalliaan,项目名称:Rubedo,代码行数:13,代码来源:ToolShovel.java


注:本文中的net.minecraft.item.ItemSpade类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。