本文整理汇总了Java中org.bukkit.entity.Fish类的典型用法代码示例。如果您正苦于以下问题:Java Fish类的具体用法?Java Fish怎么用?Java Fish使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Fish类属于org.bukkit.entity包,在下文中一共展示了Fish类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iceFishing
import org.bukkit.entity.Fish; //导入依赖的package包/类
public void iceFishing(Fish hook, Block block) {
// Make a hole
block.setType(Material.STATIONARY_WATER);
for (int x = -1; x <= 1; x++) {
for (int z = -1; z <= 1; z++) {
Block relative = block.getRelative(x, 0, z);
if (relative.getType() == Material.ICE) {
relative.setType(Material.STATIONARY_WATER);
}
}
}
// Recast in the new spot
EventUtils.callFakeFishEvent(getPlayer(), hook);
}
示例2: masterAngler
import org.bukkit.entity.Fish; //导入依赖的package包/类
public void masterAngler(Fish hook) {
Player player = getPlayer();
Location location = hook.getLocation();
double biteChance = hook.getBiteChance();
hookLocation = location;
if (Fishing.masterAnglerBiomes.contains(location.getBlock().getBiome())) {
biteChance = biteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier();
}
if (player.isInsideVehicle() && player.getVehicle().getType() == EntityType.BOAT) {
biteChance = biteChance * AdvancedConfig.getInstance().getMasterAnglerBoatModifier();
}
hook.setBiteChance(Math.min(biteChance, 1.0));
}
示例3: isFishing
import org.bukkit.entity.Fish; //导入依赖的package包/类
@Override
public boolean isFishing() {
if(player.getItemInHand().getType() == Material.FISHING_ROD) {
for(Entity entity : player.getNearbyEntities(16, 16, 16)) {
if(entity instanceof Fish) {
Fish fish = (Fish) entity;
if(fish.getShooter() instanceof Player) {
Player p = (Player) fish.getShooter();
if(p.equals(player)) {
return true;
}
}
}
}
}
return false;
}
示例4: onPlayerFishEvent
import org.bukkit.entity.Fish; //导入依赖的package包/类
@EventHandler
public void onPlayerFishEvent(PlayerFishEvent event) {
Fish hook = event.getHook();
if (event.getState() != PlayerFishEvent.State.FISHING) {
boolean isBlock = false;
for (int dx = -1; dx <= 1; dx++) {
for (int dy = -1; dy <= 1; dy++) {
for (int dz = -1; dz <= 1; dz++) {
if (!RParticles.isAirlike(hook.getWorld().getBlockAt(hook.getLocation().getBlockX() + dx, hook.getLocation().getBlockY() + dy, hook.getLocation().getBlockZ() + dz))) {
isBlock = true;
break;
}
}
}
}
try {
event.getPlayer().getEquipment().getItemInMainHand().setDurability((short) 0);
} catch (Exception e) {
}
if (isBlock) {
pullEntityToLocation(event.getPlayer(), hook.getLocation());
} else {
event.getPlayer().sendMessage(ChatColor.RED + "Your grapple wasn't hooked on anything.");
}
}
}
示例5: launchProjectile
import org.bukkit.entity.Fish; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
net.minecraft.entity.Entity launch = null;
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
} else if (Arrow.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityPotion(world, getHandle(), CraftItemStack.asNMSCopy(new ItemStack(Material.POTION, 1)));
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityExpBottle(world, getHandle());
} else if (Fish.class.isAssignableFrom(projectile) && getHandle() instanceof net.minecraft.entity.player.EntityPlayer) {
launch = new net.minecraft.entity.projectile.EntityFishHook(world, (net.minecraft.entity.player.EntityPlayer) getHandle());
} else if (Fireball.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
Vector direction = location.getDirection().multiply(10);
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else {
launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
}
((net.minecraft.entity.projectile.EntityFireball) launch).projectileSource = this;
launch.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
Validate.notNull(launch, "Projectile not supported");
if (velocity != null) {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}
world.spawnEntityInWorld(launch);
return (T) launch.getBukkitEntity();
}
示例6: PlayerFishEvent
import org.bukkit.entity.Fish; //导入依赖的package包/类
public PlayerFishEvent(final Player player, final Entity entity, final Fish hookEntity, final State state) {
super(player);
this.entity = entity;
this.hookEntity = hookEntity;
this.state = state;
}
示例7: getReturnType
import org.bukkit.entity.Fish; //导入依赖的package包/类
public Class<? extends Fish> getReturnType() {
return Fish.class;
}
示例8: get
import org.bukkit.entity.Fish; //导入依赖的package包/类
@Nullable
protected Fish[] get(Event e) {
return new Fish[]{((PlayerFishEvent)e).getHook()};
}
示例9: FakePlayerFishEvent
import org.bukkit.entity.Fish; //导入依赖的package包/类
public FakePlayerFishEvent(Player player, Entity entity, Fish hookEntity, State state) {
super(player, entity, hookEntity, state);
}
示例10: callFakeFishEvent
import org.bukkit.entity.Fish; //导入依赖的package包/类
public static FakePlayerFishEvent callFakeFishEvent(Player player, Fish hook) {
FakePlayerFishEvent event = new FakePlayerFishEvent(player, null, hook, PlayerFishEvent.State.FISHING);
mcMMO.p.getServer().getPluginManager().callEvent(event);
return event;
}
示例11: getHook
import org.bukkit.entity.Fish; //导入依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public Fish getHook() {
throw new NotImplementedException("TODO"); // TODO
}
示例12: PlayerFishEvent
import org.bukkit.entity.Fish; //导入依赖的package包/类
public PlayerFishEvent(Player player, Entity entity, Fish hookEntity, PlayerFishEvent.State state) {
super(player);
}
示例13: getHook
import org.bukkit.entity.Fish; //导入依赖的package包/类
public Fish getHook() {
return null;
}
示例14: getHook
import org.bukkit.entity.Fish; //导入依赖的package包/类
/**
* Gets the fishing hook.
*
* @return Fish the entity representing the fishing hook/bobber.
*/
public Fish getHook() {
return hookEntity;
}