本文整理了Java中org.bukkit.entity.Item.setVelocity()
方法的一些代码示例,展示了Item.setVelocity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item.setVelocity()
方法的具体详情如下:
包路径:org.bukkit.entity.Item
类名称:Item
方法名:setVelocity
暂无
代码示例来源:origin: stackoverflow.com
Entity arrow = event.getEntity();
Vector velocity = arrow.getVelocity();
Item item = arrow.getWorld().dropItem(arrow.getLocation(), ItemStack);
item.setVelocity(velocity);
代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common
public void dropItem(Location dropLocation, ItemStack itemStack) {
Item item = this.game.getRegion().getWorld().dropItemNaturally(dropLocation, itemStack);
item.setPickupDelay(0);
if (this.spread != 1.0) {
item.setVelocity(item.getVelocity().multiply(this.spread));
}
}
代码示例来源:origin: BedwarsRel/BedwarsRel
public void dropItem(Location dropLocation, ItemStack itemStack) {
Item item = this.game.getRegion().getWorld().dropItemNaturally(dropLocation, itemStack);
item.setPickupDelay(0);
if (this.spread != 1.0) {
item.setVelocity(item.getVelocity().multiply(this.spread));
}
}
代码示例来源:origin: TheBusyBiscuit/Slimefun4
private void insertItem(Player p, Block b) {
final ItemStack stack = p.getInventory().getItemInMainHand();
if (stack != null) {
PlayerInventory.consumeItemInHand(p);
String nametag = StringUtils.formatItemName(stack, false);
Item entity = b.getWorld().dropItem(b.getLocation().add(0.5, 1.2, 0.5), new CustomItem(new CustomItem(stack, 1), "&5&dALTAR &3Probe - &e" + System.nanoTime()));
entity.setVelocity(new Vector(0, 0.1, 0));
entity.setMetadata("no_pickup", new FixedMetadataValue(SlimefunStartup.instance, "altar_item"));
entity.setCustomNameVisible(true);
entity.setCustomName(nametag);
p.playSound(b.getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.3F, 0.3F);
}
}
代码示例来源:origin: ProjectKorra/ProjectKorra
public void shootMetal() {
if (this.bPlayer.isOnCooldown("MetalClips Shoot")) {
return;
}
this.bPlayer.addCooldown("MetalClips Shoot", this.shootCooldown);
final ItemStack is = new ItemStack(Material.IRON_INGOT, 1);
if (!this.player.getInventory().containsAtLeast(is, 1)) {
return;
}
final Item item = this.player.getWorld().dropItemNaturally(this.player.getLocation().add(0, 1, 0), is);
Vector vector;
final Entity targetedEntity = GeneralMethods.getTargetedEntity(this.player, this.range, new ArrayList<Entity>());
if (targetedEntity != null) {
vector = GeneralMethods.getDirection(this.player.getLocation(), targetedEntity.getLocation());
} else {
vector = GeneralMethods.getDirection(this.player.getLocation(), GeneralMethods.getTargetedLocation(this.player, this.range));
}
item.setVelocity(vector.normalize().add(new Vector(0, 0.1, 0).multiply(1.2)));
this.trackedIngots.add(item);
this.player.getInventory().removeItem(is);
}
代码示例来源:origin: ProjectKorra/ProjectKorra
iron.setVelocity(vector.normalize().multiply(this.magnetPower).add(new Vector(0, 0.2, 0)));
代码示例来源:origin: BigScary/GriefPrevention
ItemStack itemStack = new ItemStack(entity.getMaterial(), 1, entity.getBlockData());
Item item = block.getWorld().dropItem(entity.getLocation(), itemStack);
item.setVelocity(new Vector());
代码示例来源:origin: EngineHub/WorldGuard
ItemStack itemStack = new ItemStack(fallingBlock.getBlockData().getMaterial(), 1);
Item item = block.getWorld().dropItem(fallingBlock.getLocation(), itemStack);
item.setVelocity(new Vector());
if (Events.fireAndTestCancel(new SpawnEntityEvent(event, create(block, entity), item))) {
item.remove();
内容来源于网络,如有侵权,请联系作者删除!