本文整理汇总了Java中net.minecraft.item.ItemBow类的典型用法代码示例。如果您正苦于以下问题:Java ItemBow类的具体用法?Java ItemBow怎么用?Java ItemBow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItemBow类属于net.minecraft.item包,在下文中一共展示了ItemBow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checks
import net.minecraft.item.ItemBow; //导入依赖的package包/类
private boolean checks() {
if (Wrapper.thePlayer() == null || Wrapper.theWorld() == null)
return false;
if (!Wrapper.thePlayer().func_70089_S())
return false;
if (Wrapper.currentScreen() != null)
return false;
if (Wrapper.getHeldItem() == null || !(ItemUtil.getItemFromStack(Wrapper.getHeldItem()) instanceof ItemBow))
return false;
if (Bit.getInstance().getGlobalValueManager().find_bool("weapon only").getValue()
&& !Wrapper.isHoldingWeapon())
return false;
return true;
}
示例2: matches
import net.minecraft.item.ItemBow; //导入依赖的package包/类
@Override
public boolean matches(InventoryCrafting inv, World worldIn) {
int australium = 0;
ItemStack stack2 = ItemStack.EMPTY;
for (int x = 0; x < inv.getSizeInventory(); x++) {
ItemStack stack = inv.getStackInSlot(x);
if (!stack.isEmpty())
if (stack.getItem() == TF2weapons.itemTF2 && stack.getMetadata() == 2) {
if (australium < 8)
australium++;
else
return false;
} else if (stack2.isEmpty() && (stack.getItem() instanceof ItemTool
|| stack.getItem() instanceof ItemSword || stack.getItem() instanceof ItemBow
|| stack.getItem() instanceof ItemUsable || stack.getItem() instanceof ItemCloak))
stack2 = stack;
else
return false;
}
// System.out.println("matches "+(australium&&stack2!=null));
return australium == 8 && !stack2.isEmpty();
}
示例3: onUse
import net.minecraft.item.ItemBow; //导入依赖的package包/类
@Override
public boolean onUse()
{
EntityPlayer p;
p = this.player.getPlayer();
if (p.getCurrentEquippedItem() != null)
{
if (p.getCurrentEquippedItem().getItem() instanceof ItemBow)
{
PacketSpellToServer packet;
packet = new PacketSpellToServer(getUniqueID());
Packets.network.sendToServer(packet);
}
else
player.getPlayer().addChatComponentMessage(new ChatComponentText(ChatColor.RED + "You must equip a bow for this." + ChatColor.RESET));
}
else
player.getPlayer().addChatComponentMessage(new ChatComponentText(ChatColor.RED + "You must equip a bow for this." + ChatColor.RESET));
return (true);
}
示例4: handle_refinement
import net.minecraft.item.ItemBow; //导入依赖的package包/类
/** Enchantement de l'arc Dragon Slayer */
public static void handle_refinement(World world, EntityPlayerMP sender)
{
ItemStack item;
if (sender.getCurrentEquippedItem() != null)
{
item = sender.getCurrentEquippedItem();
if (item.getItem() instanceof ItemBow && !item.isItemEnchanted())
{
item.addEnchantment(Enchantment.power, 2);
item.addEnchantment(Enchantment.flame, 2);
item.addEnchantment(Enchantment.smite, 2);
item.addEnchantment(Enchantment.unbreaking, 5);
item.addEnchantment(Enchantment.infinity, 5);
item.setStackDisplayName("Refined " + sender.getCommandSenderName() + "'s Bow");
}
}
}
示例5: countAmmo
import net.minecraft.item.ItemBow; //导入依赖的package包/类
private int countAmmo(EntityPlayerSP player) {
ItemStack current = player.inventory.getCurrentItem();
if(current != null) {
if(current.getItem() instanceof ItemBow) {
int enchant = net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.init.Enchantments.INFINITY, current);
if(enchant > 0) {
return INFINITE_AMMO;
}
return countItem(player.inventory, ItemArrow.class);
} else if(current.getItem() instanceof FunWeaponItem) {
return INFINITE_AMMO;
} else if(current.getItem() instanceof WeaponItem) {
return countAmmo(player.inventory, ((WeaponItem) current.getItem()).getDefinition().getAmmoType());
}
}
return INFINITE_AMMO;
}
示例6: onUpdate
import net.minecraft.item.ItemBow; //导入依赖的package包/类
@Override
public void onUpdate() {
if (Minecraft.getMinecraft().thePlayer.getHealth() > 0 && (Minecraft.getMinecraft().thePlayer.onGround ||
Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) &&
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem() != null &&
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem() instanceof ItemBow &&
Minecraft.getMinecraft().gameSettings.keyBindUseItem.pressed) {
Minecraft.getMinecraft().playerController
.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld,
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem());
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem()
.onItemRightClick(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer);
for (int i = 0; i < 20; i++) {
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(false));
}
Minecraft.getMinecraft().getNetHandler().addToSendQueue(
new C07PacketPlayerDigging(Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem()
.onPlayerStoppedUsing(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer, 10);
}
}
示例7: onPlayerStoppedUsing
import net.minecraft.item.ItemBow; //导入依赖的package包/类
@Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entity, int chargeTimer) {
// if (entity.onGround == false) { return; }
if (entity instanceof EntityPlayer == false) {
return;
}
EntityPlayer player = (EntityPlayer) entity;
if (player.getCooldownTracker().hasCooldown(stack.getItem())) {
return;
}
int charge = this.getMaxItemUseDuration(stack) - chargeTimer;
//bow konws how to say , how charged up am i, ok heres your power
float power = Math.min(MAX_POWER, ItemBow.getArrowVelocity(charge) * POWER_UPSCALE);
Vec3d vec = player.getLookVec().normalize();
int rev = (ActionType.isForward(stack)) ? 1 : -1;
power *= rev;//flip it the other way if we are going backwards
player.addVelocity(vec.x * power,
vec.y * power / VERTICAL_FACTOR,
vec.z * power);
player.addPotionEffect(new PotionEffect(PotionEffectRegistry.BOUNCE, POTION_TIME, 0));
UtilSound.playSound(player, player.getPosition(), SoundRegistry.bwoaaap, SoundCategory.PLAYERS, 0.1F);
player.getCooldownTracker().setCooldown(stack.getItem(), COOLDOWN);
super.onUse(stack, player, world, EnumHand.MAIN_HAND);
}
示例8: initGui
import net.minecraft.item.ItemBow; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void initGui()
{
EntityPlayer player = this.mc.player;
ItemStack stack = player.inventory.getCurrentItem();
NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
if (player != null && stack != null && nbt != null && stack.getItem() instanceof ItemBow)
{
attributes = new GuiButton[BowAttribute.BOW_ATTRIBUTES.size()];
for (int i = 0; i < attributes.length; i++)
{
attributes[i] = new GuiButton(i, width / 2 - 147, 60 + (i * 20), 75, 20, BowAttribute.BOW_ATTRIBUTES.get(i).getName(nbt));
this.buttonList.add(attributes[i]);
attributes[i].enabled = false;
}
}
}
示例9: actionPerformed
import net.minecraft.item.ItemBow; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
protected void actionPerformed(GuiButton button) throws IOException
{
EntityPlayerSP player = mc.player;
ItemStack stack = player.inventory.getCurrentItem();
NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
if (player != null && stack != null && nbt != null)
{
if (Experience.getAttributeTokens(nbt) > 0)
{
if (stack.getItem() instanceof ItemBow)
{
for (int i = 0; i < attributes.length; i++)
{
if (button == attributes[i])
Levels.network.sendToServer(new PacketAttributeSelection(i));
}
}
}
}
}
示例10: onTooltip
import net.minecraft.item.ItemBow; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onTooltip(ItemTooltipEvent event)
{
ArrayList<String> tooltip = (ArrayList<String>) event.getToolTip();
ItemStack stack = event.getItemStack();
NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
if (stack != null && nbt != null)
{
if (stack.getItem() instanceof ItemSword || stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemBow || stack.getItem() instanceof ItemShield || stack.getItem() instanceof ItemTool)
{
Rarity rarity = Rarity.getRarity(nbt);
if (rarity != Rarity.DEFAULT)
{
addTooltips(tooltip, stack, nbt);
}
}
}
}
示例11: onCreateWeapon
import net.minecraft.item.ItemBow; //导入依赖的package包/类
@SubscribeEvent
public void onCreateWeapon(PlayerTickEvent event)
{
if (!event.player.getEntityWorld().isRemote)
{
if (event.phase == Phase.START)
{
for (ItemStack stack : event.player.inventory.mainInventory)
{
if (stack != null && (stack.getItem() instanceof ItemSword || stack.getItem() instanceof ItemBow || stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemShield))
{
create(stack, event.player);
}
}
}
}
}
示例12: onPlayerDeath
import net.minecraft.item.ItemBow; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerDeath(PlayerDropsEvent event)
{
EntityPlayer player = event.getEntityPlayer();
Item item;
for (int i = 0; i < event.getDrops().size(); i++)
{
item = event.getDrops().get(i).getEntityItem().getItem();
if (item != null && (item instanceof ItemSword || item instanceof ItemShield || item instanceof ItemArmor || item instanceof ItemBow))
{
ItemStack stack = event.getDrops().get(i).getEntityItem();
NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
if (nbt != null)
{
if (WeaponAttribute.SOUL_BOUND.hasAttribute(nbt) || ArmorAttribute.SOUL_BOUND.hasAttribute(nbt) || BowAttribute.SOUL_BOUND.hasAttribute(nbt) || ShieldAttribute.SOUL_BOUND.hasAttribute(nbt))
{
event.getDrops().remove(i);
player.inventory.addItemStackToInventory(stack);
}
}
}
}
}
示例13: onBowFire
import net.minecraft.item.ItemBow; //导入依赖的package包/类
@SuppressWarnings("static-access")
@SubscribeEvent
public void onBowFire(ArrowLooseEvent event)
{
EntityPlayer player = event.getEntityPlayer();
ItemStack stack = event.getBow();
NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
if (player != null && stack != null && nbt != null && !player.getEntityWorld().isRemote)
{
if (BowAttribute.BARRAGE.hasAttribute(nbt))
{
for (int i = 0; i < (int) BowAttribute.BARRAGE.getCalculatedValue(nbt, 3, 1.5); i++)
{
EntityArrow entityarrow = new EntityTippedArrow(player.getEntityWorld(), player);
entityarrow.setAim(player, player.rotationPitch, player.rotationYaw, 0, ((ItemBow) event.getBow().getItem()).getArrowVelocity(event.getCharge()) * 3, 20F);
entityarrow.pickupStatus = PickupStatus.DISALLOWED;
player.getEntityWorld().spawnEntity(entityarrow);
}
}
}
}
示例14: isItemValid
import net.minecraft.item.ItemBow; //导入依赖的package包/类
@Override
protected boolean isItemValid(TileEntity tileEntity, ItemStack itemStack)
{
Class<?> cls = tileEntity.getClass();
if(cls != TEToolRack.class)
return false;
Item item = itemStack.getItem();
return item instanceof ItemTool ||
item instanceof ItemWeapon ||
item instanceof ItemHoe ||
item instanceof ItemProPick ||
item instanceof ItemBow ||
item instanceof ItemSword ||
item instanceof ItemAxe ||
item instanceof ItemSpade ||
item instanceof ItemShears ||
item instanceof ItemSpindle
;
}
示例15: func_77972_a
import net.minecraft.item.ItemBow; //导入依赖的package包/类
public void func_77972_a(int p_77972_1_, EntityLivingBase p_77972_2_) {
if(!(p_77972_2_ instanceof EntityPlayer) || !((EntityPlayer)p_77972_2_).field_71075_bZ.field_75098_d) {
if(this.func_77984_f()) {
if(this.func_96631_a(p_77972_1_, p_77972_2_.func_70681_au())) {
p_77972_2_.func_70669_a(this);
--this.field_77994_a;
if(p_77972_2_ instanceof EntityPlayer) {
EntityPlayer var3 = (EntityPlayer)p_77972_2_;
var3.func_71064_a(StatList.field_75930_F[this.field_77993_c], 1);
if(this.field_77994_a == 0 && this.func_77973_b() instanceof ItemBow) {
var3.func_71028_bD();
}
}
if(this.field_77994_a < 0) {
this.field_77994_a = 0;
}
this.field_77991_e = 0;
}
}
}
}