當前位置: 首頁>>代碼示例>>Java>>正文


Java ActionResult.getResult方法代碼示例

本文整理匯總了Java中net.minecraft.util.ActionResult.getResult方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionResult.getResult方法的具體用法?Java ActionResult.getResult怎麽用?Java ActionResult.getResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.util.ActionResult的用法示例。


在下文中一共展示了ActionResult.getResult方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processRightClick

import net.minecraft.util.ActionResult; //導入方法依賴的package包/類
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 = actionresult.getResult();

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

            return actionresult.getType();
        }
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:32,代碼來源:PlayerControllerMP.java

示例2: processRightClick

import net.minecraft.util.ActionResult; //導入方法依賴的package包/類
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,代碼行數:32,代碼來源:PlayerControllerMP.java

示例3: processRightClick

import net.minecraft.util.ActionResult; //導入方法依賴的package包/類
public EnumActionResult processRightClick(EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand)
{
    if (this.currentGameType == GameType.SPECTATOR)
    {
        return EnumActionResult.PASS;
    }
    else
    {
        this.syncCurrentPlayItem();
        this.connection.sendPacket(new CPacketPlayerTryUseItem(hand));

        if (player.getCooldownTracker().hasCooldown(stack.getItem()))
        {
            return EnumActionResult.PASS;
        }
        else
        {
            if (net.minecraftforge.common.ForgeHooks.onItemRightClick(player, hand, stack)) return net.minecraft.util.EnumActionResult.PASS;
            int i = stack.stackSize;
            ActionResult<ItemStack> actionresult = stack.useItemRightClick(worldIn, player, hand);
            ItemStack itemstack = (ItemStack)actionresult.getResult();

            if (itemstack != stack || itemstack.stackSize != i)
            {
                player.setHeldItem(hand, itemstack);

                if (itemstack.stackSize <= 0)
                {
                    player.setHeldItem(hand, (ItemStack)null);
                    net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack, hand);
                }
            }

            return actionresult.getType();
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:38,代碼來源:PlayerControllerMP.java

示例4: processRightClick

import net.minecraft.util.ActionResult; //導入方法依賴的package包/類
public EnumActionResult processRightClick(EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand)
{
    if (this.gameType == GameType.SPECTATOR)
    {
        return EnumActionResult.PASS;
    }
    else if (player.getCooldownTracker().hasCooldown(stack.getItem()))
    {
        return EnumActionResult.PASS;
    }
    else
    {
        int i = stack.func_190916_E();
        int j = stack.getMetadata();
        ActionResult<ItemStack> actionresult = stack.useItemRightClick(worldIn, player, hand);
        ItemStack itemstack = (ItemStack)actionresult.getResult();

        if (itemstack == stack && itemstack.func_190916_E() == i && itemstack.getMaxItemUseDuration() <= 0 && itemstack.getMetadata() == j)
        {
            return actionresult.getType();
        }
        else if (actionresult.getType() == EnumActionResult.FAIL && itemstack.getMaxItemUseDuration() > 0 && !player.isHandActive())
        {
            return actionresult.getType();
        }
        else
        {
            player.setHeldItem(hand, itemstack);

            if (this.isCreative())
            {
                itemstack.func_190920_e(i);

                if (itemstack.isItemStackDamageable())
                {
                    itemstack.setItemDamage(j);
                }
            }

            if (itemstack.func_190926_b())
            {
                player.setHeldItem(hand, ItemStack.field_190927_a);
            }

            if (!player.isHandActive())
            {
                ((EntityPlayerMP)player).sendContainerToPlayer(player.inventoryContainer);
            }

            return actionresult.getType();
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:54,代碼來源:PlayerInteractionManager.java

示例5: processRightClick

import net.minecraft.util.ActionResult; //導入方法依賴的package包/類
public EnumActionResult processRightClick(EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand)
{
    if (this.gameType == GameType.SPECTATOR)
    {
        return EnumActionResult.PASS;
    }
    else if (player.getCooldownTracker().hasCooldown(stack.getItem()))
    {
        return EnumActionResult.PASS;
    }
    else
    {
        if (net.minecraftforge.common.ForgeHooks.onItemRightClick(player, hand, stack)) return net.minecraft.util.EnumActionResult.PASS;
        int i = stack.stackSize;
        int j = stack.getMetadata();
        ActionResult<ItemStack> actionresult = stack.useItemRightClick(worldIn, player, hand);
        ItemStack itemstack = (ItemStack)actionresult.getResult();

        if (itemstack == stack && itemstack.stackSize == i && itemstack.getMaxItemUseDuration() <= 0 && itemstack.getMetadata() == j)
        {
            return actionresult.getType();
        }
        else
        {
            player.setHeldItem(hand, itemstack);

            if (this.isCreative())
            {
                itemstack.stackSize = i;

                if (itemstack.isItemStackDamageable())
                {
                    itemstack.setItemDamage(j);
                }
            }

            if (itemstack.stackSize == 0)
            {
                player.setHeldItem(hand, (ItemStack)null);
                net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack, hand);
            }

            if (!player.isHandActive())
            {
                ((EntityPlayerMP)player).sendContainerToPlayer(player.inventoryContainer);
            }

            return actionresult.getType();
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:52,代碼來源:PlayerInteractionManager.java


注:本文中的net.minecraft.util.ActionResult.getResult方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。