• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ItemEgg类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: isThrowable

import net.minecraft.item.ItemEgg; //导入依赖的package包/类
public boolean isThrowable() {
	if (item instanceof ItemBow || item instanceof ItemSnowball || item instanceof ItemEgg
			|| item instanceof ItemEnderPearl || item instanceof ItemSplashPotion
			|| item instanceof ItemLingeringPotion || item instanceof ItemFishingRod) {
		return true;
	}
	return false;
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:9,代码来源:IItem.java


示例2: onItemRightClick

import net.minecraft.item.ItemEgg; //导入依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
	ItemStack stack = playerIn.getHeldItem(hand);
	if (playerIn.isSneaking() && hand == EnumHand.MAIN_HAND) {
		/*
		}
		for (int i = 0; i < 5; ++i) {
			RayTraceResult rayTrace = playerIn.rayTrace(i, 1.0F);
			if (rayTrace != null) {
				BlockPos pos = rayTrace.getBlockPos();
				EnumFacing side = rayTrace.sideHit;
				float hitX = (float) rayTrace.hitVec.xCoord;
				float hitY = (float) rayTrace.hitVec.yCoord;
				float hitZ = (float) rayTrace.hitVec.zCoord;
				IBlockState state = worldIn.getBlockState(pos);
				Block block = state.getBlock();
				boolean flag = block.onBlockActivated(worldIn, pos, state, playerIn, hand, itemStackIn, side, hitX, hitY, hitZ);
				if (rayTrace.getBlockPos() != null && (flag || block != Blocks.AIR || block instanceof ITileEntityProvider || (!flag && block.hasTileEntity(state)))) {
				if (rayTrace.getBlockPos() != null && (block != Blocks.AIR || block instanceof ITileEntityProvider || block.hasTileEntity(state))) {
					return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn);
				}
			}
		}
		*/
		ModGuiHandler.launchGui(GUIType.DANKNULL, playerIn, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);
		return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
	}
	else {
		if (!worldIn.isRemote) {
			InventoryDankNull inventory = new InventoryDankNull(stack);
			ItemStack selectedStack = DankNullUtils.getSelectedStack(inventory);

			if ((selectedStack.getItem() instanceof ItemSnowball) || (selectedStack.getItem() instanceof ItemEnderPearl) || (selectedStack.getItem() instanceof ItemEgg)) {
				//TODO soon!
				return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
			}

			EntityPFakePlayer fakePlayer = EntityPFakePlayer.getFakePlayerForParent(playerIn);
			if (fakePlayer.interactionManager.getGameType() != GameType.NOT_SET) {
				fakePlayer.interactionManager.setGameType(GameType.NOT_SET);
			}
			fakePlayer.setHeldItem(EnumHand.MAIN_HAND, selectedStack);
			fakePlayer.setItemInHand(selectedStack);
			fakePlayer.posX = playerIn.posX;
			fakePlayer.posY = playerIn.posY;
			fakePlayer.posZ = playerIn.posZ;
			fakePlayer.setRotationYawHead(playerIn.rotationYawHead);
			fakePlayer.rotationYaw = playerIn.rotationYaw;
			fakePlayer.rotationPitch = playerIn.rotationPitch;
			fakePlayer.eyeHeight = playerIn.eyeHeight;

			if (selectedStack.copy().getItem().onItemRightClick(worldIn, fakePlayer, hand).getType() == EnumActionResult.SUCCESS) {
				DankNullUtils.decrSelectedStackSize(inventory, 0);
			}
			return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
		}
	}
	return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:60,代码来源:ItemDankNull.java


示例3: isThrowable

import net.minecraft.item.ItemEgg; //导入依赖的package包/类
private boolean isThrowable(Item item) {
	return item instanceof ItemBow || item instanceof ItemSnowball
			|| item instanceof ItemEgg || item instanceof ItemEnderPearl;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:Trajectories.java


示例4: playerItemPickup

import net.minecraft.item.ItemEgg; //导入依赖的package包/类
/** Alters behaviour when player picks up an item. */
@SubscribeEvent
public void playerItemPickup(EntityItemPickupEvent event) {
    
    EntityPlayer player = event.getEntityPlayer();
    
    ItemStack stack = event.getItem().getEntityItem();
    Item item = stack.getItem();
    
    // Special case for laid eggs
    if (item instanceof ItemEgg) {
        
        int count = stack.getCount();
        stack = ItemSimple.newStack(GeoItems.EGG, count, player.world);
    }

    if (player.getCapability(GeoCaps.CAP_PLAYER, null).canPickup(item)) {
        
        stack = ContainerInventory.add(player, stack);
    }

    if (stack.isEmpty()) {

        event.getItem().setDead();

    } else {
        
        event.getItem().setEntityItemStack(stack);
    }

    event.setCanceled(true);
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:33,代码来源:PlayerEvents.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IllegalRawDataException类代码示例发布时间:2022-05-22
下一篇:
Java Exportable类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap