本文整理匯總了Java中net.minecraft.util.ActionResult.getType方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionResult.getType方法的具體用法?Java ActionResult.getType怎麽用?Java ActionResult.getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.ActionResult
的用法示例。
在下文中一共展示了ActionResult.getType方法的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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}