當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。