本文整理匯總了Java中net.minecraft.entity.Entity.setPosition方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.setPosition方法的具體用法?Java Entity.setPosition怎麽用?Java Entity.setPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.Entity
的用法示例。
在下文中一共展示了Entity.setPosition方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updatePassenger
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void updatePassenger(Entity passenger)
{
super.updatePassenger(passenger);
if (passenger instanceof EntityLiving)
{
EntityLiving entityliving = (EntityLiving)passenger;
this.renderYawOffset = entityliving.renderYawOffset;
}
if (this.prevRearingAmount > 0.0F)
{
float f3 = MathHelper.sin(this.renderYawOffset * 0.017453292F);
float f = MathHelper.cos(this.renderYawOffset * 0.017453292F);
float f1 = 0.7F * this.prevRearingAmount;
float f2 = 0.15F * this.prevRearingAmount;
passenger.setPosition(this.posX + (double)(f1 * f3), this.posY + this.getMountedYOffset() + passenger.getYOffset() + (double)f2, this.posZ - (double)(f1 * f));
if (passenger instanceof EntityLivingBase)
{
((EntityLivingBase)passenger).renderYawOffset = this.renderYawOffset;
}
}
}
示例2: onEntityCollidedWithBlock
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
TileEntityElevatorBase te = getElevatorTE(world, pos);
if (te != null && te.oldExtension != te.extension) {
entity.setPosition(entity.posX, te.getPos().getY() + 1 + te.extension, entity.posZ);
}
entity.fallDistance = 0;
}
示例3: moveEntityToCenter
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private void moveEntityToCenter(Entity entity) {
/*
* this is for your own protection. you may hurt yourself if you're not standing right, especially
* on multiblock-elevators (entity will be found by multiple bases, causing problems)
*/
entity.setPosition(getPos().getX() + 0.5F, entity.posY, getPos().getZ() + 0.5F);
}
示例4: setPositions
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public static void setPositions(Entity ent, double x, double y, double z) {
ent.setPosition(0.0D, 0.0D, 0.0D);
ent.prevPosX = ent.lastTickPosX = ent.posX = x;
ent.prevPosY = ent.lastTickPosY = ent.posY = y;
ent.prevPosZ = ent.lastTickPosZ = ent.posZ = z;
ent.setPosition(x, y, z);
}
示例5: placeInPortal
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
public void placeInPortal(Entity pEntity, float rotationYaw) {
this.worldServerInstance.getBlockState(new BlockPos((int) this.x, (int) this.y, (int) this.z)); //dummy load to maybe gen chunk
pEntity.setPosition(this.x, this.y, this.z);
pEntity.motionX = 0.0f;
pEntity.motionY = 0.0f;
pEntity.motionZ = 0.0f;
}
示例6: updateEntityPositionClient
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public static void updateEntityPositionClient(int entityID, double x, double y, double z)
{
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(entityID);
if (entity == null) { return; } // Doesn't exist? Shame.
// Entity exists, so setting its position now
entity.setPosition(x, y, z);
}
示例7: updatePassenger
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void updatePassenger(Entity passenger)
{
if (this.isPassenger(passenger))
{
float f = 0.0F;
float f1 = (float)((this.isDead ? 0.009999999776482582D : this.getMountedYOffset()) + passenger.getYOffset());
if (this.getPassengers().size() > 1)
{
int i = this.getPassengers().indexOf(passenger);
if (i == 0)
{
f = 0.2F;
}
else
{
f = -0.6F;
}
if (passenger instanceof EntityAnimal)
{
f = (float)((double)f + 0.2D);
}
}
Vec3d vec3d = (new Vec3d((double)f, 0.0D, 0.0D)).rotateYaw(-this.rotationYaw * 0.017453292F - ((float)Math.PI / 2F));
passenger.setPosition(this.posX + vec3d.xCoord, this.posY + (double)f1, this.posZ + vec3d.zCoord);
passenger.rotationYaw += this.deltaRotation;
passenger.setRotationYawHead(passenger.getRotationYawHead() + this.deltaRotation);
this.applyYawToEntity(passenger);
if (passenger instanceof EntityAnimal && this.getPassengers().size() > 1)
{
int j = passenger.getEntityId() % 2 == 0 ? 90 : 270;
passenger.setRenderYawOffset(((EntityAnimal)passenger).renderYawOffset + (float)j);
passenger.setRotationYawHead(passenger.getRotationYawHead() + (float)j);
}
}
}
示例8: updatePassenger
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void updatePassenger(Entity passenger)
{
if (this.isPassenger(passenger))
{
float f = MathHelper.cos(this.renderYawOffset * 0.017453292F);
float f1 = MathHelper.sin(this.renderYawOffset * 0.017453292F);
float f2 = 0.3F;
passenger.setPosition(this.posX + (double)(0.3F * f1), this.posY + this.getMountedYOffset() + passenger.getYOffset(), this.posZ - (double)(0.3F * f));
}
}
示例9: updatePassenger
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void updatePassenger(Entity passenger)
{
super.updatePassenger(passenger);
float f = MathHelper.sin(this.renderYawOffset * 0.017453292F);
float f1 = MathHelper.cos(this.renderYawOffset * 0.017453292F);
float f2 = 0.1F;
float f3 = 0.0F;
passenger.setPosition(this.posX + (double)(0.1F * f), this.posY + (double)(this.height * 0.5F) + passenger.getYOffset() + 0.0D, this.posZ - (double)(0.1F * f1));
if (passenger instanceof EntityLivingBase)
{
((EntityLivingBase)passenger).renderYawOffset = this.renderYawOffset;
}
}
示例10: func_190970_b
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private void func_190970_b(World p_190970_1_, BlockPos p_190970_2_)
{
IBlockState iblockstate = Blocks.DIRT.getDefaultState();
p_190970_1_.setBlockState(p_190970_2_, iblockstate);
AxisAlignedBB axisalignedbb = iblockstate.getCollisionBoundingBox(p_190970_1_, p_190970_2_).offset(p_190970_2_);
for (Entity entity : p_190970_1_.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb))
{
entity.setPosition(entity.posX, axisalignedbb.maxY, entity.posZ);
}
}
示例11: spawnWitherSkeleton
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private void spawnWitherSkeleton(World world, BlockPos toSpawnIn) {
Entity wither = new EntityWitherSkeleton(world);
wither.setPosition(toSpawnIn.getX(), toSpawnIn.getY() + 0.5, toSpawnIn.getZ());
world.spawnEntity(wither);
}
示例12: fire
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private synchronized boolean fire() {
Entity itemShot = getCloseEntityIfUpgraded();
if (getPressure() >= PneumaticValues.MIN_PRESSURE_AIR_CANNON && (itemShot != null || !inventory.getStackInSlot(CANNON_SLOT).isEmpty())) {
double[] velocity = getVelocityVector(heightAngle, rotationAngle, getForce());
addAir((int) (-500 * getForce()));
boolean shootingInventory = false;
if (itemShot == null) {
shootingInventory = true;
itemShot = getPayloadEntity();
if (itemShot instanceof EntityItem) {
inventory.setStackInSlot(CANNON_SLOT, ItemStack.EMPTY);
if (getUpgrades(EnumUpgrade.BLOCK_TRACKER) > 0) {
trackedItems.add((EntityItem) itemShot);
}
} else {
inventory.extractItem(CANNON_SLOT, 1, false);
}
} else if (itemShot instanceof EntityPlayer) {
EntityPlayerMP entityplayermp = (EntityPlayerMP) itemShot;
if (entityplayermp.connection.getNetworkManager().isChannelOpen()) {
//This is a nasty hack to get around "player moved wrongly!" messages, which can be caused if player movement
// triggers a player teleport (e.g. player moves onto pressure plate, triggers air cannon with an entity tracker).
entityplayermp.invulnerableDimensionChange = true;
entityplayermp.setPositionAndUpdate(getPos().getX() + 0.5D, getPos().getY() + 1.8D, getPos().getZ() + 0.5D);
}
}
if (itemShot.isRiding()) {
itemShot.dismountRidingEntity();
}
itemShot.setPosition(getPos().getX() + 0.5D, getPos().getY() + 1.8D, getPos().getZ() + 0.5D);
NetworkHandler.sendToAllAround(new PacketSetEntityMotion(itemShot, velocity[0], velocity[1], velocity[2]),
new TargetPoint(getWorld().provider.getDimension(), getPos().getX(), getPos().getY(), getPos().getZ(), 64));
if (itemShot instanceof EntityFireball) {
velocity[0] *= 0.05D;
velocity[1] *= 0.05D;
velocity[2] *= 0.05D;
}
itemShot.motionX = velocity[0];
itemShot.motionY = velocity[1];
itemShot.motionZ = velocity[2];
itemShot.onGround = false;
itemShot.collided = false;
itemShot.collidedHorizontally = false;
itemShot.collidedVertically = false;
if (itemShot instanceof EntityLivingBase) ((EntityLivingBase) itemShot).setJumping(true);
if (shootingInventory && !getWorld().isRemote) getWorld().spawnEntity(itemShot);
for (int i = 0; i < 10; i++) {
double velX = velocity[0] * 0.4D + (rand.nextGaussian() - 0.5D) * 0.05D;
double velY = velocity[1] * 0.4D + (rand.nextGaussian() - 0.5D) * 0.05D;
double velZ = velocity[2] * 0.4D + (rand.nextGaussian() - 0.5D) * 0.05D;
NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.SMOKE_LARGE, getPos().getX() + 0.5D, getPos().getY() + 0.7D, getPos().getZ() + 0.5D, velX, velY, velZ), getWorld());
}
NetworkHandler.sendToAllAround(new PacketPlaySound(Sounds.CANNON_SOUND, SoundCategory.BLOCKS, getPos().getX(), getPos().getY(), getPos().getZ(), 1.0F, rand.nextFloat() / 4F + 0.75F, true), getWorld());
return true;
} else {
return false;
}
}
示例13: setPos
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public static void setPos(Entity ent, BlockPos pos) {
ent.setPosition(getX(pos), getY(pos), getZ(pos));
}
示例14: setPosition
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public static void setPosition(Entity ent, Vec3d vec) {
ent.setPosition(getX(vec), getY(vec), getZ(vec));
}
示例15: teleport
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void teleport(Entity entity, World world) {
EntityPlayerMP playerMP = (EntityPlayerMP) entity;
double dx = 0;
double dy = 0;
double dz = 0;
WorldInfo wi = worldserver.getWorldInfo();
if (wi != null) {
dx = wi.getSpawnX();
dy = wi.getSpawnY();
dz = wi.getSpawnZ();
}
// check for zeros
if (dx == 0 && dy == 0 && dz == 0) {
// Set height to something big
dy = 250;
// Drop down until find solid
while (world.getBlockState(new BlockPos((int) dx, (int) dy - 1, (int) dz)).equals(Blocks.AIR.getDefaultState()) && dy > 0) {
dy--;
}
// Last check if dy == 0
if (dy == 0) {
dy = 128;
}
}
// Offset locations for accuracy
dx = dx + 0.5d;
dy = dy + 1.0d;
dz = dz + 0.5d;
entity.setPosition(dx, dy, dz);
// Freeze motion
entity.motionX = entity.motionY = entity.motionZ = 0.0D;
playerMP.setPosition(dx, dy, dz);
if (playerMP.world.provider.getDimension() != world.provider.getDimension()) {
playerMP.getServer().getPlayerList().transferPlayerToDimension(playerMP, world.provider.getDimension(), this);
}
entity.setPosition(dx, dy, dz);
}