当前位置: 首页>>代码示例>>Java>>正文


Java Location.add方法代码示例

本文整理汇总了Java中org.bukkit.Location.add方法的典型用法代码示例。如果您正苦于以下问题:Java Location.add方法的具体用法?Java Location.add怎么用?Java Location.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.Location的用法示例。


在下文中一共展示了Location.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPlayerMoveEvent

import org.bukkit.Location; //导入方法依赖的package包/类
@EventHandler
public void onPlayerMoveEvent(PlayerMoveEvent e) {
	for (Entity en : e.getPlayer().getWorld().getEntities()) {
		if (en.getCustomName() != null && en.getCustomName().equals(getName()) && en.getLocation().distance(e.getTo()) <= 1) {
			Location l = en.getLocation();
			//e.getPlayer().sendMessage(getPlayerDirection(e.getPlayer()));
			if (getPlayerDirection(e.getPlayer()).equals("north")) {
				l.add(-1.2, 0, 0);	
			}
			else if (getPlayerDirection(e.getPlayer()).equals("south")) {
				l.add(1.2, 0, 0);	
			}
			else if (getPlayerDirection(e.getPlayer()).equals("east")) {
				l.add(0, 0, -1.2);	
			}
			else if (getPlayerDirection(e.getPlayer()).equals("west")) {
				l.add(0, 0, 1.2);	
			}
			else {
				l = e.getPlayer().getLocation();
			}
			l.setDirection(e.getPlayer().getLocation().getDirection());
			e.setTo(l);
		}
	}
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:27,代码来源:GhostBlock.java

示例2: onRun

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
    Location location = getLocation();
    location.add(0, 1.0f, 0);
    for (int i = 0; i < 30; i++) {
        Vector v = RandomUtils.getRandomCircleVector().multiply(RandomUtils.random.nextDouble() * cloudSize);
        display(cloudParticle, location.add(v), cloudColor, 0, 3);
        location.subtract(v);
    }
    Location l = location.add(0, -0.05, 0);
    for (int i = 0; i < 15; i++) {
        int r = RandomUtils.random.nextInt(3);
        double x = RandomUtils.random.nextDouble() * particleRadius;
        double z = RandomUtils.random.nextDouble() * particleRadius;
        if (r == 1) {
            l.add(x, 0, z);
            display(mainParticle, l);
            l.subtract(x, 0, z);
            l.subtract(x, 0, z);
            display(mainParticle, l);
            l.add(x, 0, z);
        }
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:25,代码来源:RainyDayEffect.java

示例3: onRun

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
    Location location = getLocation();
    for (int j = step; j <= step + perTick; j++) {
        currY -= 0.025d;
        for (int i = 1; i <= strands; i++) {
            float ratio = ((float) j) / particles;
            double angle = curve * ratio * 2.0f * Math.PI / strands + 2.0f * Math.PI * i / strands + rotation;
            double x = Math.cos(angle) * ratio * radius;
            double z = Math.sin(angle) * ratio * radius;
            double y = currY;
            location.add(x, y, z);
            display(particle, location);
            location.subtract(x, y, z);
        }
    }
    if (step > particles - perTick) {
        step = 0;
        currY = START_Y;
    } else {
        step += perTick;
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:24,代码来源:BloodHelixEffect.java

示例4: makeFloatingText

import org.bukkit.Location; //导入方法依赖的package包/类
public static ArmorStand makeFloatingText(String name, Location loc, double xzOffset, double yMin, double yMax, double durationSec) {
    loc.add(-xzOffset / 2 + (Math.random() * (xzOffset)), (Math.random() * (yMax - yMin)) + yMin, -xzOffset / 2 + (Math.random() * (xzOffset)));
    final ArmorStand as = (ArmorStand) REntities.createLivingEntity(CustomArmorStand.class, loc);
    as.setVisible(false);
    as.setSmall(true);
    as.setMarker(true);
    as.setGravity(false);
    as.setArms(false);
    as.setBasePlate(false);
    as.setCanPickupItems(false);
    as.setCustomName(name);
    as.setCustomNameVisible(true);
    as.setRemoveWhenFarAway(false);
    RScheduler.schedule(SakiCore.plugin, new Runnable() {
        public void run() {
            if (as != null && as.isValid())
                as.remove();
        }
    }, RTicks.seconds(durationSec));
    return as;
}
 
开发者ID:edasaki,项目名称:ZentrelaCore,代码行数:22,代码来源:RTags.java

示例5: onRun

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
    Location location = getLocation();
    for (int i = 1; i <= strands; i++) {
        double angle = 2 * i * Math.PI / strands + rotation;
        for (int j = 1; j <= particlesStrand; j++) {
            float ratio = (float) j / particlesStrand;
            double x, y, z;
            x = Math.cos(angle) * radius * ratio;
            y = Math.sin(Math.PI * j / particlesStrand) * height;
            z = Math.sin(angle) * radius * ratio;
            location.add(x, y, z);
            display(particle, location);
            location.subtract(x, y, z);
        }
    }
    for (int i = 0; i < particlesSpout; i++) {
        Vector v = RandomUtils.getRandomCircleVector().multiply(RandomUtils.random.nextFloat() * radius * radiusSpout);
        v.setY(RandomUtils.random.nextFloat() * heightSpout);
        location.add(v);
        display(particle, location);
        location.subtract(v);
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:25,代码来源:WaterSpoutEffect.java

示例6: lightTorch

import org.bukkit.Location; //导入方法依赖的package包/类
@PuzzleTrigger
public void lightTorch(CommandBlock cmd) {
    Location loc = cmd.getLocation();
    for (int i = 0; i < 10; i++) {
        loc.add(0, 1, 0);
        if (loc.getBlock().getType() == Material.REDSTONE_TORCH_ON)
            resetFakeBlock(loc.getBlock());
    }

    getDungeon().playSound(Sound.BLOCK_NOTE_HARP, 1.25F);
    getDungeon().playSound(Sound.BLOCK_NOTE_HARP, 1F);
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:13,代码来源:GatherPuzzle.java

示例7: onRun

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
    if (font == null) {
        cancel();
        return;
    }
    Location location = getLocation();
    location.add(0, 1.2, 0);
    if(!lockedYaw) {
        yaw = -location.getYaw();
        dir = location.getDirection();
        dir = dir.normalize().setY(0);
        lockedYaw = true;
    }
    location.add(dir);
    try {
        if (image == null) {
            image = StringParser.stringToBufferedImage(font, text);
        }
        for (int y = 0; y < image.getHeight(); y += stepY) {
            for (int x = 0; x < image.getWidth(); x += stepX) {
                int clr = image.getRGB(image.getWidth() - 1 - x, y);
                if (clr != Color.black.getRGB())
                    continue;
                Vector v = new Vector((float) image.getWidth() / 2 - x, (float) image.getHeight() / 2 - y, 0).multiply(size);
                VectorUtils.rotateAroundAxisY(v, yaw * MathUtils.degreesToRadians);
                display(particle, location.add(v));
                location.subtract(v);
            }
        }
    } catch (Exception ex) {
        cancel(true);
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:35,代码来源:InfernoTagEffect.java

示例8: getCameraPosition

import org.bukkit.Location; //导入方法依赖的package包/类
private Location getCameraPosition() {
    Location camera = gate.clone();
    camera.add(face.getModX() * -4, 2, face.getModZ() * -4);
    camera.setPitch(10);
    camera.setYaw(face.getOppositeFace().ordinal() * 90);
    return camera;
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:8,代码来源:PuzzleDoorCutscene.java

示例9: cast

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public boolean cast(final Player p, PlayerDataRPG pd, int level) {
    int duration = 5;
    switch (level) {
        case 1:
            duration = 5;
            break;
        case 2:
            duration = 6;
            break;
        case 3:
            duration = 7;
            break;
        case 4:
            duration = 8;
            break;
        case 5:
            duration = 9;
            break;
    }
    ArrayList<Location> locs = new ArrayList<Location>();
    final Location startLoc = p.getLocation().clone();
    locs.add(startLoc.clone().add(1, 0, 1));
    locs.add(startLoc.clone().add(1, 0, -1));
    locs.add(startLoc.clone().add(-1, 0, 1));
    locs.add(startLoc.clone().add(-1, 0, -1));
    for(Location loc : locs) {
        for(int k = 0 ; k < 5; k++) {
            RParticles.showWithSpeed(ParticleEffect.SPELL_WITCH, loc, 0, 20);
            loc = loc.add(0, 1, 0);
        }
    }
    pd.giveBuff(PowerStance.BUFF_ID, 0, duration * 1000);
    Spell.notify(p, "You assume a stance of great stability.");
    Spell.notifyDelayed(p, "You stop using your power stance.", duration);
    return true;
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:38,代码来源:PowerStance.java

示例10: onRun

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
    Location location = getLocation();
    location.add(0, 1.0f, 0);
    location.add(Math.cos(radialsPerStep * step) * radius, 0, Math.sin(radialsPerStep * step) * radius);
    ParticleEffect.NOTE.display(location, visibleRange, 0, 0, 0, .5f, 1);
    step++;
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:9,代码来源:MusicalEffect.java

示例11: EntitySonicSquid

import org.bukkit.Location; //导入方法依赖的package包/类
EntitySonicSquid(World world, Player player)
{
    super(world);

    try
    {
        Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
        bField.setAccessible(true);
        Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
        cField.setAccessible(true);

        bField.set(this.goalSelector, Sets.newLinkedHashSet());
        bField.set(this.targetSelector, Sets.newLinkedHashSet());
        cField.set(this.goalSelector, Sets.newLinkedHashSet());
        cField.set(this.targetSelector, Sets.newLinkedHashSet());

        ((Navigation) getNavigation()).a(true);
    }
    catch (ReflectiveOperationException ignored) {}

    Location copy = player.getLocation().clone();

    while (copy.getBlock().getType() == Material.WATER || copy.getBlock().getType() == Material.STATIONARY_WATER)
        copy.add(0.0D, 1.0D, 0.0D);

    this.setPosition(player.getLocation().getX(), copy.getY() - 1.35D, player.getLocation().getZ());
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:28,代码来源:EntitySonicSquid.java

示例12: teleport_LocationAndCause_LocationSet

import org.bukkit.Location; //导入方法依赖的package包/类
@Test
public void teleport_LocationAndCause_LocationSet()
{
	Location location = player.getLocation();
	location.add(0, 10.0, 0);
	player.teleport(location, TeleportCause.CHORUS_FRUIT);
	player.assertTeleported(location, 0);
	assertEquals(TeleportCause.CHORUS_FRUIT, player.getTeleportCause());
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:10,代码来源:PlayerMockTest.java

示例13: moveEntity

import org.bukkit.Location; //导入方法依赖的package包/类
public static void moveEntity(Entity mrobject, Integer decreetogo) {
 Location location = new Location(Bukkit.getWorld("world"), 0, flyingheight, 1);
 double radians = Math.toRadians(decreetogo);
 double x = Math.cos(radians);
 double z = Math.sin(radians);
 location.add(x * 5.4, 0, z * 5.4);
 CommonEntity < ? > commonMinecart = CommonEntity.get(mrobject);
 commonMinecart.setLocation(location.getX(), location.getY(), location.getZ(), decreetogo, decreetogo);
 location.subtract(x, 0, z);
}
 
开发者ID:Mindgamesnl,项目名称:UselessCode,代码行数:11,代码来源:DumbDropTowerTest.java

示例14: teleport_Entity_LocationSetToEntity

import org.bukkit.Location; //导入方法依赖的package包/类
@Test
public void teleport_Entity_LocationSetToEntity()
{
	PlayerMock player2 = new PlayerMockFactory().createRandomPlayer();
	Location location = player2.getLocation();
	location.add(0, 5, 0);
	player2.teleport(location);
	player.teleport(player2);
	player.assertTeleported(location, 0);
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:11,代码来源:PlayerMockTest.java

示例15: cast

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public boolean cast(final Player p, PlayerDataRPG pd, int level) {
    int duration = 3;
    switch (level) {
        case 1:
            duration = 3;
            break;
        case 2:
            duration = 4;
            break;
        case 3:
            duration = 5;
            break;
    }
    ArrayList<Location> locs = new ArrayList<Location>();
    final Location startLoc = p.getLocation().clone();
    locs.add(startLoc.clone().add(1, 0, 1));
    locs.add(startLoc.clone().add(1, 0, 0));
    locs.add(startLoc.clone().add(1, 0, -1));
    locs.add(startLoc.clone().add(0, 0, 1));
    locs.add(startLoc.clone().add(0, 0, 0));
    locs.add(startLoc.clone().add(0, 0, -1));
    locs.add(startLoc.clone().add(-1, 0, 1));
    locs.add(startLoc.clone().add(-1, 0, 0));
    locs.add(startLoc.clone().add(-1, 0, -1));
    for (Location loc : locs) {
        for (int k = 0; k < 10; k++) {
            RParticles.showWithSpeed(ParticleEffect.PORTAL, loc, 0, 10);
            loc = loc.add(0, 0.5, 0);
        }
    }
    pd.giveBuff(ChantOfNecessarius.BUFF_ID, 0, duration * 1000);
    Spell.notify(p, "You begin an ancient chant of divine protection.");
    Spell.notifyDelayed(p, "You finish your chant.", duration);
    return true;
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:37,代码来源:ChantOfNecessarius.java


注:本文中的org.bukkit.Location.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。