本文整理汇总了Java中net.minecraft.util.EnumActionResult.SUCCESS属性的典型用法代码示例。如果您正苦于以下问题:Java EnumActionResult.SUCCESS属性的具体用法?Java EnumActionResult.SUCCESS怎么用?Java EnumActionResult.SUCCESS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.util.EnumActionResult
的用法示例。
在下文中一共展示了EnumActionResult.SUCCESS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemUse
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand,
EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if (!player.canPlayerEdit(pos.offset(facing), facing, stack))
{
return EnumActionResult.FAIL;
}else{
if (ItemDye.applyBonemeal(stack, worldIn, pos, player, hand))
{
if (!worldIn.isRemote)
{
worldIn.playEvent(2005, pos, 0);
}
return EnumActionResult.SUCCESS;
}else{
return EnumActionResult.PASS;
}
}
}
示例2: onItemUse
@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
ItemStack stack = playerIn.getHeldItem(hand);
Upgrades upgrade = Upgrades.values()[stack.getMetadata()];
IBlockState state = world.getBlockState(pos);
if (state.getBlock() == MoreFurnaces.blockFurnaces)
{
if (useOnModFurnace(playerIn, world, pos, stack, upgrade)) return EnumActionResult.SUCCESS;
} else if (state.getBlock() == Blocks.FURNACE || state.getBlock() == Blocks.LIT_FURNACE)
{
if (upgrade.isVanillaUpgrade())
{
if (useOnVanillaFurnace(playerIn, world, pos, stack, upgrade)) return EnumActionResult.SUCCESS;
}
}
return EnumActionResult.PASS;
}
示例3: onItemRightClick
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
if (playerIn.fishEntity != null)
{
int i = playerIn.fishEntity.handleHookRetraction();
itemStackIn.damageItem(i, playerIn);
playerIn.swingArm(hand);
}
else
{
worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!worldIn.isRemote)
{
worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn));
}
playerIn.swingArm(hand);
playerIn.addStat(StatList.getObjectUseStats(this));
}
return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
示例4: onItemRightClick
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
ItemStack itemstack = worldIn.getHeldItem(playerIn);
ItemStack itemstack1 = worldIn.capabilities.isCreativeMode ? itemstack.copy() : itemstack.splitStack(1);
itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_LINGERINGPOTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!itemStackIn.isRemote)
{
EntityPotion entitypotion = new EntityPotion(itemStackIn, worldIn, itemstack1);
entitypotion.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, -20.0F, 0.5F, 1.0F);
itemStackIn.spawnEntityInWorld(entitypotion);
}
worldIn.addStat(StatList.getObjectUseStats(this));
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
示例5: onItemUse
@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
IBlockState state = worldIn.getBlockState(pos);
ItemStack heldItem = playerIn.getHeldItem(hand);
if (heldItem.isEmpty()) {
return super.onItemUse(playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
}
if (facing == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(facing), facing, heldItem) && (state.getBlock() == net.minecraft.init.Blocks.GRASS || state.getBlock() == net.minecraft.init.Blocks.DIRT || state.getBlock() == net.minecraft.init.Blocks.SAND) && worldIn.isAirBlock(pos.up())) {
worldIn.setBlockState(pos.up(), BlockRegistry.palm_sapling.getDefaultState());
heldItem.shrink(1);
return EnumActionResult.SUCCESS;
} else {
return EnumActionResult.FAIL;
}
}
示例6: onItemUse
/**
* Called when a Block is right-clicked with this Item
*/
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos);
if (facing == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(facing), facing, stack) && (state.getBlock()== net.minecraft.init.Blocks.GRASS ||state.getBlock()==net.minecraft.init.Blocks.DIRT|| state.getBlock()==net.minecraft.init.Blocks.FARMLAND) && worldIn.isAirBlock(pos.up()))
{
worldIn.setBlockState(pos.up(), this.getSaplingState());
--stack.stackSize;
return EnumActionResult.SUCCESS;
}
else
{
return EnumActionResult.FAIL;
}
}
示例7: onItemRightClick
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
if (!world.isRemote) {
IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
for (int i = 0; i < baubles.getSlots(); i++)
if (baubles.getStackInSlot(i).isEmpty() && baubles.isItemValidForSlot(i, player.getHeldItem(hand), player)) {
baubles.setStackInSlot(i, player.getHeldItem(hand).copy());
if (!player.capabilities.isCreativeMode) {
player.setHeldItem(hand, ItemStack.EMPTY);
}
onEquipped(player.getHeldItem(hand), player);
break;
}
}
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}
示例8: onItemUse
/**
* Called when a Block is right-clicked with this Item
*/
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
worldIn = worldIn.offset(hand);
ItemStack itemstack = stack.getHeldItem(pos);
if (!stack.canPlayerEdit(worldIn, hand, itemstack))
{
return EnumActionResult.FAIL;
}
else
{
if (playerIn.getBlockState(worldIn).getMaterial() == Material.AIR)
{
playerIn.playSound(stack, worldIn, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
playerIn.setBlockState(worldIn, Blocks.FIRE.getDefaultState(), 11);
}
itemstack.damageItem(1, stack);
return EnumActionResult.SUCCESS;
}
}
示例9: onItemRightClick
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
if (!playerIn.capabilities.isCreativeMode)
{
--itemStackIn.stackSize;
}
worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SPLASH_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!worldIn.isRemote)
{
EntityPotion entitypotion = new EntityPotion(worldIn, playerIn, itemStackIn);
entitypotion.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, -20.0F, 0.5F, 1.0F);
worldIn.spawnEntityInWorld(entitypotion);
}
playerIn.addStat(StatList.getObjectUseStats(this));
return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
示例10: onItemUse
/**
* Called when a Block is right-clicked with this Item
*/
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos);
if (facing == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(facing), facing, stack) && state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up()))
{
worldIn.setBlockState(pos.up(), this.crops.getDefaultState(), 11);
--stack.stackSize;
return EnumActionResult.SUCCESS;
}
else
{
return EnumActionResult.FAIL;
}
}
示例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;
}
示例12: onItemUse
/**
* Called when a Block is right-clicked with this Item
*/
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
ItemStack itemstack = stack.getHeldItem(pos);
BlockPos blockpos = worldIn.offset(hand);
if (hand != EnumFacing.DOWN && hand != EnumFacing.UP && stack.canPlayerEdit(blockpos, hand, itemstack))
{
EntityHanging entityhanging = this.createEntity(playerIn, blockpos, hand);
if (entityhanging != null && entityhanging.onValidSurface())
{
if (!playerIn.isRemote)
{
entityhanging.playPlaceSound();
playerIn.spawnEntityInWorld(entityhanging);
}
itemstack.func_190918_g(1);
}
return EnumActionResult.SUCCESS;
}
else
{
return EnumActionResult.FAIL;
}
}
示例13: onItemRightClick
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn,
EnumHand hand) {
ItemStack itemStackIn = playerIn.getHeldItem(hand);
if (TF2Attribute.getModifier("Rage Crit", itemStackIn, 0, playerIn)!=0 &&playerIn.getCapability(TF2weapons.WEAPONS_CAP, null).getPhlogRage()>=20f) {
playerIn.setActiveHand(hand);
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn);
}
return new ActionResult<ItemStack>(EnumActionResult.FAIL, itemStackIn);
}
示例14: onItemRightClick
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
ItemStack itemstack = worldIn.getHeldItem(playerIn);
if (!itemStackIn.isRemote)
{
this.resolveContents(itemstack, worldIn);
}
worldIn.openBook(itemstack, playerIn);
worldIn.addStat(StatList.getObjectUseStats(this));
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
示例15: onItemRightClick
@Override
@SideOnly (Side.CLIENT)
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack itemStack = player.getHeldItem(hand);
if (world.isRemote) {
WirelessRedstone.proxy.openPSnifferGui(player);
RedstoneEtherAddons.client().addSniffer(player);
return new ActionResult<>(EnumActionResult.SUCCESS, itemStack);
}
return new ActionResult<>(EnumActionResult.PASS, itemStack);
}