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


Java EnumActionResult.PASS属性代码示例

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


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

示例1: onItemUseFirst

@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {

	if (!world.isRemote) {

		if (world.getBlockState(pos) instanceof IExtendedBlockState) {

			if(world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof TileTube) {
			
				IExtendedBlockState state = (IExtendedBlockState) world.getBlockState(pos);
				ItemStack held = player.getHeldItem(hand);
				int col = held.getItemDamage();
				
				state = state.withProperty(BlockTube.COLOR, col);
				world.setBlockState(pos, state);
				
				((TileTube) world.getTileEntity(pos)).setTubeColor(col);
				PacketHandler.sendToAll(new PacketTubeSync(world.getTileEntity(pos), col));
				return EnumActionResult.SUCCESS;
			}
		}
	}

	return EnumActionResult.PASS;
}
 
开发者ID:oMilkyy,项目名称:SimpleTubes,代码行数:25,代码来源:ItemPaintbrush.java

示例2: onItemRightClick

public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    if (worldIn.isElytraFlying())
    {
        ItemStack itemstack = worldIn.getHeldItem(playerIn);

        if (!itemStackIn.isRemote)
        {
            EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(itemStackIn, itemstack, worldIn);
            itemStackIn.spawnEntityInWorld(entityfireworkrocket);

            if (!worldIn.capabilities.isCreativeMode)
            {
                itemstack.func_190918_g(1);
            }
        }

        return new ActionResult(EnumActionResult.SUCCESS, worldIn.getHeldItem(playerIn));
    }
    else
    {
        return new ActionResult(EnumActionResult.PASS, worldIn.getHeldItem(playerIn));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:ItemFirework.java

示例3: onItemRightClick

@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer player, EnumHand handIn) {
	Mouse.setGrabbed(false); // TODO Remove debug
	ItemStack is = player.getHeldItem(handIn);
	if (player.getHeldItemMainhand().getCount() > 4) {
		if (worldIn.isRemote) {
			GuiKnapping.staticMaterial = CraftMat.CLAY;
			GuiKnapping.staticMaterialSub = this.getSubName(is.getItemDamage());

			player.openGui(FirmaMod.instance, GuiHandler.GUI_KNAPPING, player.world, (int) player.posX, (int) player.posY, (int) player.posZ);
		} else {
			PlayerData pd = PlayerData.getPlayerData(player.getUniqueID());
			pd.resetKnapCraft();
			pd.setItemStack(player.getHeldItemMainhand());
			pd.setCraftingMaterial(CraftMat.CLAY);
		}
	}
	return new ActionResult<ItemStack>(EnumActionResult.PASS, is);
}
 
开发者ID:trigg,项目名称:Firma,代码行数:19,代码来源:ClayItem.java

示例4: onItemRightClick

@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer player, EnumHand handIn) {
	ItemStack is = player.getHeldItem(handIn);
	if (player.getHeldItemMainhand().getCount() > 1) {
		if (worldIn.isRemote) {
			GuiKnapping.staticMaterial = CraftMat.STONE;
			GuiKnapping.staticMaterialSub = this.getSubName(is.getItemDamage());

		} else {
			PlayerData pd = PlayerData.getPlayerData(player.getUniqueID());
			pd.resetKnapCraft();
			pd.setItemStack(player.getHeldItemMainhand());
			pd.setCraftingMaterial(CraftMat.STONE);
		}
	}
	player.openGui(FirmaMod.instance, GuiHandler.GUI_KNAPPING, player.world, (int) player.posX, (int) player.posY, (int) player.posZ);
	return new ActionResult<ItemStack>(EnumActionResult.PASS, is);
}
 
开发者ID:trigg,项目名称:Firma,代码行数:18,代码来源:PebbleItem.java

示例5: onItemRightClick

@Override
public ActionResult<ItemStack> onItemRightClick(World par2World, EntityPlayer player,
		EnumHand hand) {
	// System.out.println("lel "+stack.getTagCompound().getInteger("wait")+"
	// "+this.allowShot(player,stack, par2World));
	ItemStack stack=player.getHeldItem(hand);
	if (!(stack.hasTagCompound() && stack.getTagCompound().getInteger("wait") > 0)
			&& this.allowShot(player, stack, par2World)) {
		if (!this.usesBowAnimation(stack))
			this.use(stack, par2World, player, 1.8f,
					player.inventory.getStackInSlot(this.getSlotForUse(player, stack)), false);
		else
			// System.out.println("trying");
			player.setActiveHand(hand);
		return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
	}
	return new ActionResult<ItemStack>(EnumActionResult.PASS, stack);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:18,代码来源:TNTCannon.java

示例6: onItemUse

@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing,
		float hitX, float hitY, float hitZ)
{
	if (player.getHeldItem(hand).getItem().equals(ModRegistry.ANCIENT_PARCHMENT))
	{
		if (world.isRemote)
		{
			return EnumActionResult.PASS;
		}
		Block block = world.getBlockState(pos).getBlock();

		if (player.isSneaking() && block == Blocks.BEDROCK)
		{
			player.getCooldownTracker().setCooldown(player.getHeldItem(hand).getItem(), 150);

			player.getHeldItem(hand).shrink(1);
			world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ArcaneMagicSoundHandler.spell,
					SoundCategory.MASTER, 1f, 1f);

			world.spawnEntity(new EntityMagicCircles(world, pos.getX(), pos.getY(), pos.getZ()));

			return EnumActionResult.SUCCESS;
		}

	}
	return EnumActionResult.PASS;
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:28,代码来源:ItemParchment.java

示例7: processRightClick

public EnumActionResult processRightClick(EntityPlayer player, World worldIn, EnumHand stack)
{
    if (this.currentGameType == GameType.SPECTATOR)
    {
        return EnumActionResult.PASS;
    }
    else
    {
        this.syncCurrentPlayItem();
        this.connection.sendPacket(new CPacketPlayerTryUseItem(stack));
        ItemStack itemstack = player.getHeldItem(stack);

        if (player.getCooldownTracker().hasCooldown(itemstack.getItem()))
        {
            return EnumActionResult.PASS;
        }
        else
        {
            int i = itemstack.func_190916_E();
            ActionResult<ItemStack> actionresult = itemstack.useItemRightClick(worldIn, player, stack);
            ItemStack itemstack1 = (ItemStack)actionresult.getResult();

            if (itemstack1 != itemstack || itemstack1.func_190916_E() != i)
            {
                player.setHeldItem(stack, itemstack1);
            }

            return actionresult.getType();
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:31,代码来源:PlayerControllerMP.java

示例8: onItemRightClick

public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);
    RayTraceResult raytraceresult = this.rayTrace(itemStackIn, worldIn, false);

    if (raytraceresult != null && raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK && itemStackIn.getBlockState(raytraceresult.getBlockPos()).getBlock() == Blocks.END_PORTAL_FRAME)
    {
        return new ActionResult(EnumActionResult.PASS, itemstack);
    }
    else
    {
        worldIn.setActiveHand(playerIn);

        if (!itemStackIn.isRemote)
        {
            BlockPos blockpos = ((WorldServer)itemStackIn).getChunkProvider().getStrongholdGen(itemStackIn, "Stronghold", new BlockPos(worldIn), false);

            if (blockpos != null)
            {
                EntityEnderEye entityendereye = new EntityEnderEye(itemStackIn, worldIn.posX, worldIn.posY + (double)(worldIn.height / 2.0F), worldIn.posZ);
                entityendereye.moveTowards(blockpos);
                itemStackIn.spawnEntityInWorld(entityendereye);
                itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_ENDEREYE_LAUNCH, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
                itemStackIn.playEvent((EntityPlayer)null, 1003, new BlockPos(worldIn), 0);

                if (!worldIn.capabilities.isCreativeMode)
                {
                    itemstack.func_190918_g(1);
                }

                worldIn.addStat(StatList.getObjectUseStats(this));
                return new ActionResult(EnumActionResult.SUCCESS, itemstack);
            }
        }

        return new ActionResult(EnumActionResult.SUCCESS, itemstack);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:38,代码来源:ItemEnderEye.java

示例9: onItemRightClick

@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn,
		EnumHand hand) {
	// itemStackIn.getTagCompound().setString("pid",
	// "Player735_1510202549059");
	/*
	 * NBTTagCompound filmdata=new NBTTagCompound();
	 * filmdata.setString("id", "none"); NBTTagCompound nc=new
	 * NBTTagCompound(); itemStackIn.writeToNBT(nc); nc.setTag("tag",
	 * filmdata); itemStackIn.readFromNBT(nc);
	 */
	System.out.println("0:" + hand);
	System.out.println("1:" + playerIn.getActiveHand());
	playerIn.setActiveHand(hand);
	if (playerIn instanceof EntityPlayerMP) {
		((EntityPlayerMP) playerIn).setActiveHand(hand);
	}
	System.out.println("2:" + playerIn.getActiveHand());
	System.out.println(itemStackIn.hasTagCompound());
	// String id =itemStackIn.getTagCompound().getString("pid");
	// String user =itemStackIn.getTagCompound().getString("user");
	// System.out.println("pid="+id);
	// System.out.println("user="+user);
	// itemStackIn.getTagCompound().setString("pid", "123456");
	// itemStackIn.getTagCompound().setString("user", "PorPit");
	return new ActionResult(EnumActionResult.PASS, itemStackIn);
}
 
开发者ID:PorPit,项目名称:MineCamera,代码行数:27,代码来源:ItemFilm.java

示例10: onItemUseFirst

@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand);
    if (!world.isRemote) {
        IBlockState state = world.getBlockState(pos);
        Block block = state.getBlock();

        IPneumaticWrenchable wrenchable;
        if (block instanceof IPneumaticWrenchable) {
            wrenchable = (IPneumaticWrenchable) block;
        } else {
            wrenchable = ModInteractionUtils.getInstance().getWrenchable(world.getTileEntity(pos));
        }
        boolean didWork = true;
        float pressure = ((ItemPneumaticWrench) Itemss.PNEUMATIC_WRENCH).getPressure(stack);
        if (wrenchable != null && pressure > 0) {
            if (wrenchable.rotateBlock(world, player, pos, side)) {
                if (!player.capabilities.isCreativeMode)
                    ((ItemPneumaticWrench) Itemss.PNEUMATIC_WRENCH).addAir(stack, -PneumaticValues.USAGE_PNEUMATIC_WRENCH);
            }
        } else {
            // rotating normal blocks doesn't use pressure
            didWork = block.rotateBlock(world, pos, side);
        }
        if (didWork) playWrenchSound(world, pos);
        return didWork ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
    } else {
        // client-side: prevent GUI's opening etc.
        return EnumActionResult.SUCCESS;
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:31,代码来源:ItemPneumaticWrench.java

示例11: onItemUse

@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	if (world.isRemote) {
		RebornInfoProviderHUD.addElement(new BlockDisplayElement());
	}
	if (!world.isRemote && player.isSneaking()) {
		return EnumActionResult.SUCCESS;
	}
	return EnumActionResult.PASS;
}
 
开发者ID:TechReborn,项目名称:TechReborn3,代码行数:10,代码来源:ItemWrench.java

示例12: processRightClick

public EnumActionResult processRightClick(EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand)
{
    if (this.demoTimeExpired)
    {
        this.sendDemoReminder();
        return EnumActionResult.PASS;
    }
    else
    {
        return super.processRightClick(player, worldIn, stack, hand);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:DemoWorldManager.java

示例13: onItemRightClick

@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
	if (world.isRemote) { return new ActionResult(EnumActionResult.PASS, stack); }	// Not doing this on client side

	if (!stack.hasDisplayName())
	{
		// This needs a name via anvil first.
		
		return new ActionResult(EnumActionResult.FAIL, stack);
	}
	
	_FactionSaveData faction = TerritoryHandler.getFactionFromLeader(player);
	
	if (faction == null)
	{
		// You aren't the leader of anything
		return new ActionResult(EnumActionResult.FAIL, stack);
	}
	
	// Alright, you are the leader of something
	faction.setName(stack.getDisplayName());
	
	Main.console("Player " + player.getName() + " renamed faction to " + faction.getName() + ".");
	
	// Deplete the stack (Should only ever be one on here)
	stack.stackSize -= 1;
	
	// Send a notification to all faction members
	Main.sendMessageToFactionMembers(world, faction.getID(), "Your faction has been renamed to " + faction.getName() + "!");
	
	return new ActionResult(EnumActionResult.PASS, stack);
}
 
开发者ID:Domochevsky,项目名称:minecraft-territorialdealings,代码行数:33,代码来源:FactionRenameOrder.java

示例14: onItemUse

@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (worldIn.getBlockState(pos).getBlock() == Blocks.GRASS){
        worldIn.setBlockState(pos, Blocks.DIAMOND_BLOCK.getDefaultState());
        return EnumActionResult.SUCCESS;
    }
    return EnumActionResult.PASS;
}
 
开发者ID:F1r3w477,项目名称:ThisMod,代码行数:8,代码来源:ItemModItem.java

示例15: processRightClickBlock

public EnumActionResult processRightClickBlock(EntityPlayerSP player, WorldClient worldIn, BlockPos stack, EnumFacing pos, Vec3d facing, EnumHand vec)
{
    this.syncCurrentPlayItem();
    ItemStack itemstack = player.getHeldItem(vec);
    float f = (float)(facing.xCoord - (double)stack.getX());
    float f1 = (float)(facing.yCoord - (double)stack.getY());
    float f2 = (float)(facing.zCoord - (double)stack.getZ());
    boolean flag = false;

    if (!this.mc.world.getWorldBorder().contains(stack))
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        if (this.currentGameType != GameType.SPECTATOR)
        {
            IBlockState iblockstate = worldIn.getBlockState(stack);

            if ((!player.isSneaking() || player.getHeldItemMainhand().func_190926_b() && player.getHeldItemOffhand().func_190926_b()) && iblockstate.getBlock().onBlockActivated(worldIn, stack, iblockstate, player, vec, pos, f, f1, f2))
            {
                flag = true;
            }

            if (!flag && itemstack.getItem() instanceof ItemBlock)
            {
                ItemBlock itemblock = (ItemBlock)itemstack.getItem();

                if (!itemblock.canPlaceBlockOnSide(worldIn, stack, pos, player, itemstack))
                {
                    return EnumActionResult.FAIL;
                }
            }
        }

        this.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(stack, pos, vec, f, f1, f2));

        if (!flag && this.currentGameType != GameType.SPECTATOR)
        {
            if (itemstack.func_190926_b())
            {
                return EnumActionResult.PASS;
            }
            else if (player.getCooldownTracker().hasCooldown(itemstack.getItem()))
            {
                return EnumActionResult.PASS;
            }
            else
            {
                if (itemstack.getItem() instanceof ItemBlock && !player.canUseCommandBlock())
                {
                    Block block = ((ItemBlock)itemstack.getItem()).getBlock();

                    if (block instanceof BlockCommandBlock || block instanceof BlockStructure)
                    {
                        return EnumActionResult.FAIL;
                    }
                }

                if (this.currentGameType.isCreative())
                {
                    int i = itemstack.getMetadata();
                    int j = itemstack.func_190916_E();
                    EnumActionResult enumactionresult = itemstack.onItemUse(player, worldIn, stack, vec, pos, f, f1, f2);
                    itemstack.setItemDamage(i);
                    itemstack.func_190920_e(j);
                    return enumactionresult;
                }
                else
                {
                    return itemstack.onItemUse(player, worldIn, stack, vec, pos, f, f1, f2);
                }
            }
        }
        else
        {
            return EnumActionResult.SUCCESS;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:80,代码来源:PlayerControllerMP.java


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