本文整理汇总了Java中net.minecraft.entity.Entity.setLocationAndAngles方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.setLocationAndAngles方法的具体用法?Java Entity.setLocationAndAngles怎么用?Java Entity.setLocationAndAngles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.Entity
的用法示例。
在下文中一共展示了Entity.setLocationAndAngles方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderMob
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Render the mob inside the mob spawner.
*/
public static void renderMob(MobSpawnerBaseLogic mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks)
{
Entity entity = mobSpawnerLogic.func_180612_a(mobSpawnerLogic.getSpawnerWorld());
if (entity != null)
{
float f = 0.4375F;
GlStateManager.translate(0.0F, 0.4F, 0.0F);
GlStateManager.rotate((float)(mobSpawnerLogic.getPrevMobRotation() + (mobSpawnerLogic.getMobRotation() - mobSpawnerLogic.getPrevMobRotation()) * (double)partialTicks) * 10.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-30.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(0.0F, -0.4F, 0.0F);
GlStateManager.scale(f, f, f);
entity.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F);
Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks);
}
}
示例2: spawnEntity
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static Entity spawnEntity(World world, int id, double x, double y, double z) {
Entity entity = ModEntityList.createEntityByID(id, world);
if (entity != null && entity instanceof EntityLivingBase) {
EntityLiving entityliving = (EntityLiving) entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw;
entityliving.onSpawnWithEgg((IEntityLivingData) null);
world.spawnEntityInWorld(entity);
entityliving.playLivingSound();
}
return entity;
}
示例3: placeInPortal
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void placeInPortal(Entity entityIn, float rotationYaw)
{
if (this.worldServerInstance.provider.getDimensionId() != 1)
{
if (!this.placeInExistingPortal(entityIn, rotationYaw))
{
this.makePortal(entityIn);
this.placeInExistingPortal(entityIn, rotationYaw);
}
}
else
{
int i = MathHelper.floor_double(entityIn.posX);
int j = MathHelper.floor_double(entityIn.posY) - 1;
int k = MathHelper.floor_double(entityIn.posZ);
int l = 1;
int i1 = 0;
for (int j1 = -2; j1 <= 2; ++j1)
{
for (int k1 = -2; k1 <= 2; ++k1)
{
for (int l1 = -1; l1 < 3; ++l1)
{
int i2 = i + k1 * l + j1 * i1;
int j2 = j + l1;
int k2 = k + k1 * i1 - j1 * l;
boolean flag = l1 < 0;
this.worldServerInstance.setBlockState(new BlockPos(i2, j2, k2), flag ? Blocks.obsidian.getDefaultState() : Blocks.air.getDefaultState());
}
}
}
entityIn.setLocationAndAngles((double)i, (double)j, (double)k, entityIn.rotationYaw, 0.0F);
entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D;
}
}
示例4: addEntitiesToWorld
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
{
for (Template.EntityInfo template$entityinfo : this.entities)
{
BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);
if (aabb == null || aabb.isVecInside(blockpos))
{
NBTTagCompound nbttagcompound = template$entityinfo.entityData;
Vec3d vec3d = transformedVec3d(template$entityinfo.pos, mirrorIn, rotationIn);
Vec3d vec3d1 = vec3d.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
NBTTagList nbttaglist = new NBTTagList();
nbttaglist.appendTag(new NBTTagDouble(vec3d1.xCoord));
nbttaglist.appendTag(new NBTTagDouble(vec3d1.yCoord));
nbttaglist.appendTag(new NBTTagDouble(vec3d1.zCoord));
nbttagcompound.setTag("Pos", nbttaglist);
nbttagcompound.setUniqueId("UUID", UUID.randomUUID());
Entity entity;
try
{
entity = EntityList.createEntityFromNBT(nbttagcompound, worldIn);
}
catch (Exception var15)
{
entity = null;
}
if (entity != null)
{
float f = entity.getMirroredYaw(mirrorIn);
f = f + (entity.rotationYaw - entity.getRotatedYaw(rotationIn));
entity.setLocationAndAngles(vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, f, entity.rotationPitch);
worldIn.spawnEntityInWorld(entity);
}
}
}
}
示例5: spawnCreature
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Spawns the creature specified by the egg's type in the location specified by the last three parameters.
* Parameters: world, entityID, x, y, z.
*/
@Nullable
public static Entity spawnCreature(World worldIn, @Nullable String entityID, double x, double y, double z)
{
if (entityID != null && EntityList.ENTITY_EGGS.containsKey(entityID))
{
Entity entity = null;
for (int i = 0; i < 1; ++i)
{
entity = EntityList.createEntityByIDFromName(entityID, worldIn);
if (entity instanceof EntityLivingBase)
{
EntityLiving entityliving = (EntityLiving)entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(worldIn.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw;
entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
worldIn.spawnEntityInWorld(entity);
entityliving.playLivingSound();
}
}
return entity;
}
else
{
return null;
}
}
示例6: placeInPortal
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void placeInPortal(Entity entityIn, float rotationYaw)
{
if (this.worldServerInstance.provider.getDimensionType().getId() != 1)
{
if (!this.placeInExistingPortal(entityIn, rotationYaw))
{
this.makePortal(entityIn);
this.placeInExistingPortal(entityIn, rotationYaw);
}
}
else
{
int i = MathHelper.floor(entityIn.posX);
int j = MathHelper.floor(entityIn.posY) - 1;
int k = MathHelper.floor(entityIn.posZ);
int l = 1;
int i1 = 0;
for (int j1 = -2; j1 <= 2; ++j1)
{
for (int k1 = -2; k1 <= 2; ++k1)
{
for (int l1 = -1; l1 < 3; ++l1)
{
int i2 = i + k1 * 1 + j1 * 0;
int j2 = j + l1;
int k2 = k + k1 * 0 - j1 * 1;
boolean flag = l1 < 0;
this.worldServerInstance.setBlockState(new BlockPos(i2, j2, k2), flag ? Blocks.OBSIDIAN.getDefaultState() : Blocks.AIR.getDefaultState());
}
}
}
entityIn.setLocationAndAngles((double)i, (double)j, (double)k, entityIn.rotationYaw, 0.0F);
entityIn.motionX = 0.0D;
entityIn.motionY = 0.0D;
entityIn.motionZ = 0.0D;
}
}
示例7: spawnEntity
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Spawn entity in the world
* @param mob Mob class to spawn
* @param pos Block position where entity going to spawn
* @return Spawned entity
*/
public Entity spawnEntity(UEntityClass mob, UBlockPos pos) {
Entity entity = mob.construct(this);
entity.setLocationAndAngles(pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, new Random(System.currentTimeMillis()).nextFloat() * 360.0F, 0.0F);
world.spawnEntityInWorld(entity);
return entity;
}
示例8: spawnEntity
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Spawn entity in the world
* @param mob Mob class to spawn
* @param pos Block position where entity going to spawn
* @return Spawned entity
*/
public Entity spawnEntity(UEntityClass mob, UBlockPos pos) {
Entity entity = mob.construct(this);
entity.setLocationAndAngles(pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, new Random(System.currentTimeMillis()).nextFloat() * 360.0F, 0.0F);
world.spawnEntity(entity);
return entity;
}
示例9: spawnCreature
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Spawns the creature specified by the egg's type in the location specified by the last three parameters.
* Parameters: world, entityID, x, y, z.
*/
public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z)
{
if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID)))
{
return null;
}
else
{
Entity entity = null;
for (int i = 0; i < 1; ++i)
{
entity = EntityList.createEntityByID(entityID, worldIn);
if (entity instanceof EntityLivingBase)
{
EntityLiving entityliving = (EntityLiving)entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw;
entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
worldIn.spawnEntityInWorld(entity);
entityliving.playLivingSound();
}
}
return entity;
}
}
示例10: spawnNewEntity
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private Entity spawnNewEntity(Entity entityIn, boolean spawn)
{
if (this.getRandomEntity() != null)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
entityIn.writeToNBTOptional(nbttagcompound);
for (String s : this.getRandomEntity().nbtData.getKeySet())
{
NBTBase nbtbase = this.getRandomEntity().nbtData.getTag(s);
nbttagcompound.setTag(s, nbtbase.copy());
}
entityIn.readFromNBT(nbttagcompound);
if (entityIn.worldObj != null && spawn)
{
entityIn.worldObj.spawnEntityInWorld(entityIn);
}
NBTTagCompound nbttagcompound2;
for (Entity entity = entityIn; nbttagcompound.hasKey("Riding", 10); nbttagcompound = nbttagcompound2)
{
nbttagcompound2 = nbttagcompound.getCompoundTag("Riding");
Entity entity1 = EntityList.createEntityByName(nbttagcompound2.getString("id"), entityIn.worldObj);
if (entity1 != null)
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
entity1.writeToNBTOptional(nbttagcompound1);
for (String s1 : nbttagcompound2.getKeySet())
{
NBTBase nbtbase1 = nbttagcompound2.getTag(s1);
nbttagcompound1.setTag(s1, nbtbase1.copy());
}
entity1.readFromNBT(nbttagcompound1);
entity1.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
if (entityIn.worldObj != null && spawn)
{
entityIn.worldObj.spawnEntityInWorld(entity1);
}
entity.mountEntity(entity1);
}
entity = entity1;
}
}
else if (entityIn instanceof EntityLivingBase && entityIn.worldObj != null && spawn)
{
if (entityIn instanceof EntityLiving)
{
((EntityLiving)entityIn).onInitialSpawn(entityIn.worldObj.getDifficultyForLocation(new BlockPos(entityIn)), (IEntityLivingData)null);
}
entityIn.worldObj.spawnEntityInWorld(entityIn);
}
return entityIn;
}
示例11: transferEntityToWorld
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@SuppressWarnings("unused")
public void transferEntityToWorld(Entity entityIn, int lastDimension, WorldServer oldWorldIn, WorldServer toWorldIn, net.minecraft.world.Teleporter teleporter)
{
net.minecraft.world.WorldProvider pOld = oldWorldIn.provider;
net.minecraft.world.WorldProvider pNew = toWorldIn.provider;
double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor();
double d0 = entityIn.posX * moveFactor;
double d1 = entityIn.posZ * moveFactor;
double d2 = 8.0D;
float f = entityIn.rotationYaw;
oldWorldIn.theProfiler.startSection("moving");
if (false && entityIn.dimension == -1)
{
d0 = MathHelper.clamp_double(d0 / 8.0D, toWorldIn.getWorldBorder().minX() + 16.0D, toWorldIn.getWorldBorder().maxX() - 16.0D);
d1 = MathHelper.clamp_double(d1 / 8.0D, toWorldIn.getWorldBorder().minZ() + 16.0D, toWorldIn.getWorldBorder().maxZ() - 16.0D);
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
if (entityIn.isEntityAlive())
{
oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
}
}
else if (false && entityIn.dimension == 0)
{
d0 = MathHelper.clamp_double(d0 * 8.0D, toWorldIn.getWorldBorder().minX() + 16.0D, toWorldIn.getWorldBorder().maxX() - 16.0D);
d1 = MathHelper.clamp_double(d1 * 8.0D, toWorldIn.getWorldBorder().minZ() + 16.0D, toWorldIn.getWorldBorder().maxZ() - 16.0D);
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
if (entityIn.isEntityAlive())
{
oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
}
}
if (entityIn.dimension == 1)
{
BlockPos blockpos;
if (lastDimension == 1)
{
blockpos = toWorldIn.getSpawnPoint();
}
else
{
blockpos = toWorldIn.getSpawnCoordinate();
}
d0 = (double)blockpos.getX();
entityIn.posY = (double)blockpos.getY();
d1 = (double)blockpos.getZ();
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, 90.0F, 0.0F);
if (entityIn.isEntityAlive())
{
oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
}
}
oldWorldIn.theProfiler.endSection();
if (lastDimension != 1)
{
oldWorldIn.theProfiler.startSection("placing");
d0 = (double)MathHelper.clamp_int((int)d0, -29999872, 29999872);
d1 = (double)MathHelper.clamp_int((int)d1, -29999872, 29999872);
if (entityIn.isEntityAlive())
{
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
teleporter.placeInPortal(entityIn, f);
toWorldIn.spawnEntityInWorld(entityIn);
toWorldIn.updateEntityWithOptionalForce(entityIn, false);
}
oldWorldIn.theProfiler.endSection();
}
entityIn.setWorld(toWorldIn);
}
示例12: execute
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Callback for when the command is executed
*/
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
if (args.length < 1)
{
throw new WrongUsageException("commands.tp.usage", new Object[0]);
}
else
{
int i = 0;
Entity entity;
if (args.length != 2 && args.length != 4 && args.length != 6)
{
entity = getCommandSenderAsPlayer(sender);
}
else
{
entity = getEntity(server, sender, args[0]);
i = 1;
}
if (args.length != 1 && args.length != 2)
{
if (args.length < i + 3)
{
throw new WrongUsageException("commands.tp.usage", new Object[0]);
}
else if (entity.worldObj != null)
{
int j = 4096;
int lvt_6_2_ = i + 1;
CommandBase.CoordinateArg commandbase$coordinatearg = parseCoordinate(entity.posX, args[i], true);
CommandBase.CoordinateArg commandbase$coordinatearg1 = parseCoordinate(entity.posY, args[lvt_6_2_++], -4096, 4096, false);
CommandBase.CoordinateArg commandbase$coordinatearg2 = parseCoordinate(entity.posZ, args[lvt_6_2_++], true);
CommandBase.CoordinateArg commandbase$coordinatearg3 = parseCoordinate((double)entity.rotationYaw, args.length > lvt_6_2_ ? args[lvt_6_2_++] : "~", false);
CommandBase.CoordinateArg commandbase$coordinatearg4 = parseCoordinate((double)entity.rotationPitch, args.length > lvt_6_2_ ? args[lvt_6_2_] : "~", false);
teleportEntityToCoordinates(entity, commandbase$coordinatearg, commandbase$coordinatearg1, commandbase$coordinatearg2, commandbase$coordinatearg3, commandbase$coordinatearg4);
notifyCommandListener(sender, this, "commands.tp.success.coordinates", new Object[] {entity.getName(), Double.valueOf(commandbase$coordinatearg.getResult()), Double.valueOf(commandbase$coordinatearg1.getResult()), Double.valueOf(commandbase$coordinatearg2.getResult())});
}
}
else
{
Entity entity1 = getEntity(server, sender, args[args.length - 1]);
if (entity1.worldObj != entity.worldObj)
{
throw new CommandException("commands.tp.notSameDimension", new Object[0]);
}
else
{
entity.dismountRidingEntity();
if (entity instanceof EntityPlayerMP)
{
((EntityPlayerMP)entity).connection.setPlayerLocation(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch);
}
else
{
entity.setLocationAndAngles(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch);
}
notifyCommandListener(sender, this, "commands.tp.success", new Object[] {entity.getName(), entity1.getName()});
}
}
}
}
示例13: transferEntityToWorld
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Transfers an entity from a world to another world.
*/
public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_)
{
double d0 = entityIn.posX;
double d1 = entityIn.posZ;
double d2 = 8.0D;
float f = entityIn.rotationYaw;
p_82448_3_.theProfiler.startSection("moving");
if (entityIn.dimension == -1)
{
d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D);
d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D);
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
if (entityIn.isEntityAlive())
{
p_82448_3_.updateEntityWithOptionalForce(entityIn, false);
}
}
else if (entityIn.dimension == 0)
{
d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D);
d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D);
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
if (entityIn.isEntityAlive())
{
p_82448_3_.updateEntityWithOptionalForce(entityIn, false);
}
}
else
{
BlockPos blockpos;
if (p_82448_2_ == 1)
{
blockpos = p_82448_4_.getSpawnPoint();
}
else
{
blockpos = p_82448_4_.getSpawnCoordinate();
}
d0 = (double)blockpos.getX();
entityIn.posY = (double)blockpos.getY();
d1 = (double)blockpos.getZ();
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, 90.0F, 0.0F);
if (entityIn.isEntityAlive())
{
p_82448_3_.updateEntityWithOptionalForce(entityIn, false);
}
}
p_82448_3_.theProfiler.endSection();
if (p_82448_2_ != 1)
{
p_82448_3_.theProfiler.startSection("placing");
d0 = (double)MathHelper.clamp_int((int)d0, -29999872, 29999872);
d1 = (double)MathHelper.clamp_int((int)d1, -29999872, 29999872);
if (entityIn.isEntityAlive())
{
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
p_82448_4_.getDefaultTeleporter().placeInPortal(entityIn, f);
p_82448_4_.spawnEntityInWorld(entityIn);
p_82448_4_.updateEntityWithOptionalForce(entityIn, false);
}
p_82448_3_.theProfiler.endSection();
}
entityIn.setWorld(p_82448_4_);
}
示例14: transferEntityToWorld
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Transfers an entity from a world to another world.
*/
public void transferEntityToWorld(Entity entityIn, int lastDimension, WorldServer oldWorldIn, WorldServer toWorldIn)
{
double d0 = entityIn.posX;
double d1 = entityIn.posZ;
double d2 = 8.0D;
float f = entityIn.rotationYaw;
oldWorldIn.theProfiler.startSection("moving");
if (entityIn.dimension == -1)
{
d0 = MathHelper.clamp(d0 / 8.0D, toWorldIn.getWorldBorder().minX() + 16.0D, toWorldIn.getWorldBorder().maxX() - 16.0D);
d1 = MathHelper.clamp(d1 / 8.0D, toWorldIn.getWorldBorder().minZ() + 16.0D, toWorldIn.getWorldBorder().maxZ() - 16.0D);
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
if (entityIn.isEntityAlive())
{
oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
}
}
else if (entityIn.dimension == 0)
{
d0 = MathHelper.clamp(d0 * 8.0D, toWorldIn.getWorldBorder().minX() + 16.0D, toWorldIn.getWorldBorder().maxX() - 16.0D);
d1 = MathHelper.clamp(d1 * 8.0D, toWorldIn.getWorldBorder().minZ() + 16.0D, toWorldIn.getWorldBorder().maxZ() - 16.0D);
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
if (entityIn.isEntityAlive())
{
oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
}
}
else
{
BlockPos blockpos;
if (lastDimension == 1)
{
blockpos = toWorldIn.getSpawnPoint();
}
else
{
blockpos = toWorldIn.getSpawnCoordinate();
}
d0 = (double)blockpos.getX();
entityIn.posY = (double)blockpos.getY();
d1 = (double)blockpos.getZ();
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, 90.0F, 0.0F);
if (entityIn.isEntityAlive())
{
oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
}
}
oldWorldIn.theProfiler.endSection();
if (lastDimension != 1)
{
oldWorldIn.theProfiler.startSection("placing");
d0 = (double)MathHelper.clamp((int)d0, -29999872, 29999872);
d1 = (double)MathHelper.clamp((int)d1, -29999872, 29999872);
if (entityIn.isEntityAlive())
{
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
toWorldIn.getDefaultTeleporter().placeInPortal(entityIn, f);
toWorldIn.spawnEntityInWorld(entityIn);
toWorldIn.updateEntityWithOptionalForce(entityIn, false);
}
oldWorldIn.theProfiler.endSection();
}
entityIn.setWorld(toWorldIn);
}
示例15: teleportEntityToCoordinates
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Teleports an entity to the specified coordinates
*/
private static void teleportEntityToCoordinates(Entity p_189863_0_, CommandBase.CoordinateArg p_189863_1_, CommandBase.CoordinateArg p_189863_2_, CommandBase.CoordinateArg p_189863_3_, CommandBase.CoordinateArg p_189863_4_, CommandBase.CoordinateArg p_189863_5_)
{
if (p_189863_0_ instanceof EntityPlayerMP)
{
Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);
if (p_189863_1_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.X);
}
if (p_189863_2_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Y);
}
if (p_189863_3_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Z);
}
if (p_189863_5_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
}
if (p_189863_4_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
}
float f = (float)p_189863_4_.getAmount();
if (!p_189863_4_.isRelative())
{
f = MathHelper.wrapDegrees(f);
}
float f1 = (float)p_189863_5_.getAmount();
if (!p_189863_5_.isRelative())
{
f1 = MathHelper.wrapDegrees(f1);
}
p_189863_0_.dismountRidingEntity();
((EntityPlayerMP)p_189863_0_).connection.setPlayerLocation(p_189863_1_.getAmount(), p_189863_2_.getAmount(), p_189863_3_.getAmount(), f, f1, set);
p_189863_0_.setRotationYawHead(f);
}
else
{
float f2 = (float)MathHelper.wrapDegrees(p_189863_4_.getResult());
float f3 = (float)MathHelper.wrapDegrees(p_189863_5_.getResult());
f3 = MathHelper.clamp_float(f3, -90.0F, 90.0F);
p_189863_0_.setLocationAndAngles(p_189863_1_.getResult(), p_189863_2_.getResult(), p_189863_3_.getResult(), f2, f3);
p_189863_0_.setRotationYawHead(f2);
}
if (!(p_189863_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189863_0_).isElytraFlying())
{
p_189863_0_.motionY = 0.0D;
p_189863_0_.onGround = true;
}
}