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


Java EntityPlayer.setPositionAndUpdate方法代码示例

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


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

示例1: teleportToDimension

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static void teleportToDimension(EntityPlayer player, int dimension, double x, double y, double z) {
    int oldDimension = player.getEntityWorld().provider.getDimension();
    EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player;
    MinecraftServer server = player.getEntityWorld().getMinecraftServer();
    WorldServer worldServer = server.getWorld(dimension);
    player.addExperienceLevel(0);


    worldServer.getMinecraftServer().getPlayerList().transferPlayerToDimension(entityPlayerMP, dimension, new RfToolsTeleporter(worldServer, x, y, z));
    player.setPositionAndUpdate(x, y, z);
    if (oldDimension == 1) {
        // For some reason teleporting out of the end does weird things.
        player.setPositionAndUpdate(x, y, z);
        worldServer.spawnEntity(player);
        worldServer.updateEntityWithOptionalForce(player, false);
    }
}
 
开发者ID:elytra,项目名称:tp-plus,代码行数:18,代码来源:CommandTPP.java

示例2: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
	
	List<EntityLivingBase> elb = acquireAllLookTargets(player, 32, 3);
	for (EntityLivingBase target : elb) {
		if (target.canEntityBeSeen(player) && !(target instanceof EntityPlayer)) {
			BlockPos targetpos = target.getPosition();
			BlockPos playerpos = player.getPosition();
			if (!world.isRemote) {
				target.setPositionAndUpdate(playerpos.getX(), playerpos.getY(), playerpos.getZ());
				player.setPositionAndUpdate(targetpos.getX(), targetpos.getY(), targetpos.getZ());
				if (target instanceof EntityWolf && world.rand.nextInt(100) == 0)
					target.entityDropItem(UCItems.generic.createStack(EnumItems.DOGRESIDUE), 1);
				stack.damageItem(1, player);
				return new ActionResult(EnumActionResult.SUCCESS, stack);
			}
		}
	}
	return new ActionResult(EnumActionResult.PASS, stack);
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:21,代码来源:ItemEnderSnooker.java

示例3: teleportToDimension

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static void teleportToDimension(EntityPlayer player, int dimension, double x, double y, double z) {
    int oldDimension = player.getEntityWorld().provider.getDimension();
    EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player;
    MinecraftServer server = player.getEntityWorld().getMinecraftServer();
    WorldServer worldServer = server.getWorld(dimension);
    player.addExperienceLevel(0);


    worldServer.getMinecraftServer().getPlayerList().transferPlayerToDimension(entityPlayerMP, dimension, new WhooshTeleporter(worldServer, x, y, z));
    player.setPositionAndUpdate(x, y, z);
    if (oldDimension == 1) {
        // For some reason teleporting out of the end does weird things.
        player.setPositionAndUpdate(x, y, z);
        worldServer.spawnEntity(player);
        worldServer.updateEntityWithOptionalForce(player, false);
    }
}
 
开发者ID:ImbaKnugel,项目名称:Whoosh,代码行数:18,代码来源:TeleportUtil.java

示例4: moveMemberToReturnPoint

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void moveMemberToReturnPoint(EntityPlayer player)
{
	if (this.returnX == 0 && this.returnY == 0 && this.returnZ == 0) // No return point set
	{
		Main.sendMessageToPlayer(player, "Looks like no return point has been set set.");
		return;
	}

	player.setPositionAndUpdate(this.returnX, this.returnY, this.returnZ);

	// Different dimension, so transfering them
	if (this.returnDim != player.dimension)
	{
		Transition.transferPlayerToDimension((EntityPlayerMP) player, this.returnDim, (int) this.returnY);

		player.setPositionAndUpdate(this.returnX, this.returnY, this.returnZ);	// Setting it again, just to make sure
	}
}
 
开发者ID:Domochevsky,项目名称:minecraft-territorialdealings,代码行数:19,代码来源:_Territory.java

示例5: performTeleport

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static boolean performTeleport(World world, EntityPlayer player, TeleportPosition target) {

        BlockPos pos = target.position;
        if(world.provider.getDimension() != target.dimension) {
            teleportToDimension(player, target.dimension, pos.getX(), pos.getY(), pos.getZ());
        }
        else {
            player.setPositionAndUpdate(pos.getX()+0.5, pos.getY()+1, pos.getZ()+0.5);
        }

        return true;
    }
 
开发者ID:ImbaKnugel,项目名称:Whoosh,代码行数:13,代码来源:TeleportUtil.java

示例6: movePlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private static void movePlayer(Vec3d destination, EntityPlayer player, boolean keepMomentum) {

        player.setPositionAndUpdate(destination.x, destination.y, destination.z);

        if(keepMomentum) {
            Vec3d velocity = player.getLookVec();
            velocity = velocity.scale(0.25);
            SPacketEntityVelocity p = new SPacketEntityVelocity(player.getEntityId(), velocity.x, velocity.y, velocity.z);
            ((EntityPlayerMP) player).connection.sendPacket(p);
        }
    }
 
开发者ID:ImbaKnugel,项目名称:Whoosh,代码行数:12,代码来源:TeleportUtil.java


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