本文整理汇总了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();
}
}
}