本文整理汇总了Java中net.minecraft.item.ItemStack.interactWithEntity方法的典型用法代码示例。如果您正苦于以下问题:Java ItemStack.interactWithEntity方法的具体用法?Java ItemStack.interactWithEntity怎么用?Java ItemStack.interactWithEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.item.ItemStack
的用法示例。
在下文中一共展示了ItemStack.interactWithEntity方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processInteract
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
ItemStack itemstack = player.getHeldItem(hand);
boolean flag = itemstack.getItem() == Items.NAME_TAG;
if (flag)
{
itemstack.interactWithEntity(player, this, hand);
return true;
}
else if (!this.func_190669_a(itemstack, this.getClass()) && this.isEntityAlive() && !this.isTrading() && !this.isChild())
{
if (this.buyingList == null)
{
this.populateBuyingList();
}
if (hand == EnumHand.MAIN_HAND)
{
player.addStat(StatList.TALKED_TO_VILLAGER);
}
if (!this.world.isRemote && !this.buyingList.isEmpty())
{
this.setCustomer(player);
player.displayVillagerTradeGui(this);
}
else if (this.buyingList.isEmpty())
{
return super.processInteract(player, hand);
}
return true;
}
else
{
return super.processInteract(player, hand);
}
}
示例2: processInteract
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
if (!super.processInteract(player, hand))
{
ItemStack itemstack = player.getHeldItem(hand);
if (itemstack.getItem() == Items.NAME_TAG)
{
itemstack.interactWithEntity(player, this, hand);
return true;
}
else if (this.getSaddled() && !this.isBeingRidden())
{
if (!this.world.isRemote)
{
player.startRiding(this);
}
return true;
}
else if (itemstack.getItem() == Items.SADDLE)
{
itemstack.interactWithEntity(player, this, hand);
return true;
}
else
{
return false;
}
}
else
{
return true;
}
}
示例3: interactWith
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public boolean interactWith(Entity p_70998_1_)
{
if (this.isSpectator())
{
if (p_70998_1_ instanceof IInventory)
{
this.displayGUIChest((IInventory)p_70998_1_);
}
return false;
}
else
{
ItemStack itemstack = this.getCurrentEquippedItem();
ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null;
if (!p_70998_1_.interactFirst(this))
{
if (itemstack != null && p_70998_1_ instanceof EntityLivingBase)
{
if (this.capabilities.isCreativeMode)
{
itemstack = itemstack1;
}
if (itemstack.interactWithEntity(this, (EntityLivingBase)p_70998_1_))
{
if (itemstack.stackSize <= 0 && !this.capabilities.isCreativeMode)
{
this.destroyCurrentEquippedItem();
}
return true;
}
}
return false;
}
else
{
if (itemstack != null && itemstack == this.getCurrentEquippedItem())
{
if (itemstack.stackSize <= 0 && !this.capabilities.isCreativeMode)
{
this.destroyCurrentEquippedItem();
}
else if (itemstack.stackSize < itemstack1.stackSize && this.capabilities.isCreativeMode)
{
itemstack.stackSize = itemstack1.stackSize;
}
}
return true;
}
}
}
示例4: func_190775_a
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public EnumActionResult func_190775_a(Entity p_190775_1_, EnumHand p_190775_2_)
{
if (this.isSpectator())
{
if (p_190775_1_ instanceof IInventory)
{
this.displayGUIChest((IInventory)p_190775_1_);
}
return EnumActionResult.PASS;
}
else
{
ItemStack itemstack = this.getHeldItem(p_190775_2_);
ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.copy();
if (p_190775_1_.processInitialInteract(this, p_190775_2_))
{
if (this.capabilities.isCreativeMode && itemstack == this.getHeldItem(p_190775_2_) && itemstack.func_190916_E() < itemstack1.func_190916_E())
{
itemstack.func_190920_e(itemstack1.func_190916_E());
}
return EnumActionResult.SUCCESS;
}
else
{
if (!itemstack.func_190926_b() && p_190775_1_ instanceof EntityLivingBase)
{
if (this.capabilities.isCreativeMode)
{
itemstack = itemstack1;
}
if (itemstack.interactWithEntity(this, (EntityLivingBase)p_190775_1_, p_190775_2_))
{
if (itemstack.func_190926_b() && !this.capabilities.isCreativeMode)
{
this.setHeldItem(p_190775_2_, ItemStack.field_190927_a);
}
return EnumActionResult.SUCCESS;
}
}
return EnumActionResult.PASS;
}
}
}
示例5: processInteract
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
ItemStack itemstack = player.getHeldItem(hand);
boolean flag = !itemstack.func_190926_b();
if (flag && itemstack.getItem() == Items.SPAWN_EGG)
{
return super.processInteract(player, hand);
}
else if (!this.isTame())
{
return false;
}
else if (this.isChild())
{
return super.processInteract(player, hand);
}
else if (player.isSneaking())
{
this.openGUI(player);
return true;
}
else if (this.isBeingRidden())
{
return super.processInteract(player, hand);
}
else
{
if (flag)
{
if (itemstack.getItem() == Items.SADDLE && !this.isHorseSaddled())
{
this.openGUI(player);
return true;
}
if (itemstack.interactWithEntity(player, this, hand))
{
return true;
}
}
this.mountTo(player);
return true;
}
}
示例6: processInteract
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
ItemStack itemstack = player.getHeldItem(hand);
if (itemstack.getItem() == Items.SPAWN_EGG)
{
return super.processInteract(player, hand);
}
else
{
if (!this.isChild())
{
if (this.isTame() && player.isSneaking())
{
this.openGUI(player);
return true;
}
if (this.isBeingRidden())
{
return super.processInteract(player, hand);
}
}
if (!itemstack.func_190926_b())
{
boolean flag = this.func_190678_b(player, itemstack);
if (!flag && !this.isTame())
{
if (itemstack.interactWithEntity(player, this, hand))
{
return true;
}
this.func_190687_dF();
return true;
}
if (!flag && !this.func_190695_dh() && itemstack.getItem() == Item.getItemFromBlock(Blocks.CHEST))
{
this.setChested(true);
this.func_190697_dk();
flag = true;
this.initHorseChest();
}
if (!flag && !this.isChild() && !this.isHorseSaddled() && itemstack.getItem() == Items.SADDLE)
{
this.openGUI(player);
return true;
}
if (flag)
{
if (!player.capabilities.isCreativeMode)
{
itemstack.func_190918_g(1);
}
return true;
}
}
if (this.isChild())
{
return super.processInteract(player, hand);
}
else if (itemstack.interactWithEntity(player, this, hand))
{
return true;
}
else
{
this.mountTo(player);
return true;
}
}
}
示例7: processInteract
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
ItemStack itemstack = player.getHeldItem(hand);
boolean flag = !itemstack.func_190926_b();
if (flag && itemstack.getItem() == Items.SPAWN_EGG)
{
return super.processInteract(player, hand);
}
else if (!this.isTame())
{
return false;
}
else if (this.isChild())
{
return super.processInteract(player, hand);
}
else if (player.isSneaking())
{
this.openGUI(player);
return true;
}
else if (this.isBeingRidden())
{
return super.processInteract(player, hand);
}
else
{
if (flag)
{
if (!this.isHorseSaddled() && itemstack.getItem() == Items.SADDLE)
{
this.openGUI(player);
return true;
}
if (itemstack.interactWithEntity(player, this, hand))
{
return true;
}
}
this.mountTo(player);
return true;
}
}
示例8: processInteract
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
ItemStack itemstack = player.getHeldItem(hand);
boolean flag = !itemstack.func_190926_b();
if (flag && itemstack.getItem() == Items.SPAWN_EGG)
{
return super.processInteract(player, hand);
}
else
{
if (!this.isChild())
{
if (this.isTame() && player.isSneaking())
{
this.openGUI(player);
return true;
}
if (this.isBeingRidden())
{
return super.processInteract(player, hand);
}
}
if (flag)
{
if (this.func_190678_b(player, itemstack))
{
if (!player.capabilities.isCreativeMode)
{
itemstack.func_190918_g(1);
}
return true;
}
if (itemstack.interactWithEntity(player, this, hand))
{
return true;
}
if (!this.isTame())
{
this.func_190687_dF();
return true;
}
boolean flag1 = HorseArmorType.getByItemStack(itemstack) != HorseArmorType.NONE;
boolean flag2 = !this.isChild() && !this.isHorseSaddled() && itemstack.getItem() == Items.SADDLE;
if (flag1 || flag2)
{
this.openGUI(player);
return true;
}
}
if (this.isChild())
{
return super.processInteract(player, hand);
}
else
{
this.mountTo(player);
return true;
}
}
}
示例9: interact
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public EnumActionResult interact(Entity entityIn, @Nullable ItemStack stack, EnumHand hand)
{
if (this.isSpectator())
{
if (entityIn instanceof IInventory)
{
this.displayGUIChest((IInventory)entityIn);
}
return EnumActionResult.PASS;
}
else
{
if (net.minecraftforge.common.ForgeHooks.onInteractEntity(this, entityIn, stack, hand)) return EnumActionResult.PASS;
ItemStack itemstack = stack != null ? stack.copy() : null;
if (!entityIn.processInitialInteract(this, stack, hand))
{
if (stack != null && entityIn instanceof EntityLivingBase)
{
if (this.capabilities.isCreativeMode)
{
stack = itemstack;
}
if (stack.interactWithEntity(this, (EntityLivingBase)entityIn, hand))
{
if (stack.stackSize <= 0 && !this.capabilities.isCreativeMode)
{
net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, stack, hand);
this.setHeldItem(hand, (ItemStack)null);
}
return EnumActionResult.SUCCESS;
}
}
return EnumActionResult.PASS;
}
else
{
if (stack != null && stack == this.getHeldItem(hand))
{
if (stack.stackSize <= 0 && !this.capabilities.isCreativeMode)
{
net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, stack, hand);
this.setHeldItem(hand, (ItemStack)null);
}
else if (stack.stackSize < itemstack.stackSize && this.capabilities.isCreativeMode)
{
stack.stackSize = itemstack.stackSize;
}
}
return EnumActionResult.SUCCESS;
}
}
}