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