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


Java Items.stick方法代码示例

本文整理汇总了Java中net.minecraft.init.Items.stick方法的典型用法代码示例。如果您正苦于以下问题:Java Items.stick方法的具体用法?Java Items.stick怎么用?Java Items.stick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.init.Items的用法示例。


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

示例1: eventBreakEvent

import net.minecraft.init.Items; //导入方法依赖的package包/类
@SubscribeEvent
public void eventBreakEvent(BlockEvent.BreakEvent event) {
	World world = event.world;
	int x = event.x;
	int y = event.y;
	int z = event.z;
	EntityPlayer player = event.getPlayer();

	if (player != null && player.getHeldItem() != null && player.getHeldItem().getItem() == Items.stick) {
		if (TOConfig.debugEnable && TOConfig.debugRemover && !world.isRemote
				&& player.capabilities.isCreativeMode) {
			int radius = TOConfig.debugRemoverScannerRadius;
			for (int xx = x - radius; xx < x + radius; xx++)
				for (int zz = z - radius; zz < z + radius; zz++)
					for (int yy = 0; yy < 257; yy++)
						if (!(world.getBlock(xx, yy, zz) instanceof BlockInfusedBlockOre))
							world.setBlock(xx, yy, zz, Blocks.air, 0, 2);
			String text = "[DEBUG " + ThaumOresMod.NAME + "] Removed blocks at " + x + ";" + z + " with radius "
					+ radius;
			player.addChatMessage(new ChatComponentText(text));
			ThaumOresMod.log.info(text);
		}
	}
}
 
开发者ID:MJaroslav,项目名称:ThaumOres,代码行数:25,代码来源:TOEvents.java

示例2: getItemBurnTime

import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
 * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
 * fuel
 */
public static int getItemBurnTime(ItemStack p_145952_0_)
{
    if (p_145952_0_ == null)
    {
        return 0;
    }
    else
    {
        Item item = p_145952_0_.getItem();

        if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air)
        {
            Block block = Block.getBlockFromItem(item);

            if (block == Blocks.wooden_slab)
            {
                return 150;
            }

            if (block.getMaterial() == Material.wood)
            {
                return 300;
            }

            if (block == Blocks.coal_block)
            {
                return 16000;
            }
        }

        return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0)))))));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:38,代码来源:TileEntityFurnace.java

示例3: eventPlayerInteractEvent

import net.minecraft.init.Items; //导入方法依赖的package包/类
@SubscribeEvent
public void eventPlayerInteractEvent(PlayerInteractEvent event) {
	World world = event.world;
	int x = event.x;
	int y = event.y;
	int z = event.z;
	EntityPlayer player = event.entityPlayer;
	if (player != null && player.getHeldItem() != null && player.getHeldItem().getItem() == Items.stick) {
		if (TOConfig.debugEnable && TOConfig.debugScanner && !world.isRemote
				&& event.action.equals(Action.RIGHT_CLICK_BLOCK) && player.capabilities.isCreativeMode) {
			int radius = TOConfig.debugRemoverScannerRadius;
			int[] counter = new int[] { 0, 0, 0, 0, 0, 0 };
			for (int xx = x - radius; xx < x + radius; xx++)
				for (int zz = z - radius; zz < z + radius; zz++)
					for (int yy = 0; yy < 257; yy++)
						if ((world.getBlock(xx, yy, zz) instanceof BlockInfusedBlockOre)
								&& world.getBlockMetadata(xx, yy, zz) < 6)
							counter[world.getBlockMetadata(xx, yy, zz)]++;
			String text = "[DEBUG " + ThaumOresMod.NAME + "] Scanned blocks at " + x + ";" + z + " with radius "
					+ radius;
			for (int meta = 0; meta < 6; meta++)
				text += "\n Count ores with meta " + meta + " = " + counter[meta];
			for (String string : text.split("\n")) {
				ThaumOresMod.log.info(string);
				player.addChatMessage(new ChatComponentText(string));
			}
		}
	}
}
 
开发者ID:MJaroslav,项目名称:ThaumOres,代码行数:30,代码来源:TOEvents.java

示例4: getTabIconItem

import net.minecraft.init.Items; //导入方法依赖的package包/类
public Item getTabIconItem()
{
    return Items.stick;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:CreativeTabs.java


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