本文整理匯總了Java中javax.vecmath.Point3d.getX方法的典型用法代碼示例。如果您正苦於以下問題:Java Point3d.getX方法的具體用法?Java Point3d.getX怎麽用?Java Point3d.getX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.vecmath.Point3d
的用法示例。
在下文中一共展示了Point3d.getX方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: playSound
import javax.vecmath.Point3d; //導入方法依賴的package包/類
@Override
public void playSound(double x, double y, double z, SoundEvent sound, SoundCategory category, float volume, float pitch, boolean distanceDelay) {
Point3d transformed = this.getTransformedPosition(new Point3d(x, y, z));
x = transformed.getX();
y = transformed.getY();
z = transformed.getZ();
double distance = this.mc.getRenderViewEntity().getDistanceSq(x, y, z);
PositionedSoundRecord positionedSound = new PositionedSoundRecord(sound, category, volume, pitch, (float) x, (float) y, (float) z);
if (distanceDelay && distance > 100.0D) {
double delay = Math.sqrt(distance) / 40.0D;
this.mc.getSoundHandler().playDelayedSound(positionedSound, (int) (delay * 20.0D));
} else {
this.mc.getSoundHandler().playSound(positionedSound);
}
}
示例2: addPlayer
import javax.vecmath.Point3d; //導入方法依賴的package包/類
public void addPlayer(EntityPlayerMP player) {
BlockSystemPlayerHandler handler = BlockSystems.PROXY.getBlockSystemHandler(player.world).get(this.blockSystem, player);
Point3d playerPosition = this.getUntransformedPosition(player);
int playerChunkX = (int) playerPosition.getX() >> 4;
int playerChunkZ = (int) playerPosition.getZ() >> 4;
handler.setManagedPosX(playerPosition.getX());
handler.setManagedPosZ(playerPosition.getZ());
for (int chunkX = playerChunkX - this.playerViewRadius; chunkX <= playerChunkX + this.playerViewRadius; ++chunkX) {
for (int chunkZ = playerChunkZ - this.playerViewRadius; chunkZ <= playerChunkZ + this.playerViewRadius; ++chunkZ) {
this.getOrCreateTracker(chunkX, chunkZ).addPlayer(player);
}
}
this.players.add(player);
this.markSortPending();
}
示例3: updateMountedMovingPlayer
import javax.vecmath.Point3d; //導入方法依賴的package包/類
public void updateMountedMovingPlayer(EntityPlayerMP player) {
BlockSystemPlayerHandler handler = BlockSystems.PROXY.getBlockSystemHandler(player.world).get(this.blockSystem, player);
Point3d playerPosition = this.getUntransformedPosition(player);
int playerChunkX = (int) playerPosition.getX() >> 4;
int playerChunkZ = (int) playerPosition.getZ() >> 4;
double managedPosX = handler.getManagedPosX();
double managedPosZ = handler.getManagedPosZ();
double managedDeltaX = managedPosX - playerPosition.getX();
double managedDeltaZ = managedPosZ - playerPosition.getZ();
double managedDelta = managedDeltaX * managedDeltaX + managedDeltaZ * managedDeltaZ;
if (managedDelta >= 64.0D) {
int managedChunkX = (int) managedPosX >> 4;
int managedChunkZ = (int) managedPosZ >> 4;
int viewRadius = this.playerViewRadius;
int deltaChunkX = playerChunkX - managedChunkX;
int deltaChunkZ = playerChunkZ - managedChunkZ;
if (deltaChunkX != 0 || deltaChunkZ != 0) {
for (int chunkX = playerChunkX - viewRadius; chunkX <= playerChunkX + viewRadius; ++chunkX) {
for (int chunkZ = playerChunkZ - viewRadius; chunkZ <= playerChunkZ + viewRadius; ++chunkZ) {
if (!this.interects(chunkX, chunkZ, managedChunkX, managedChunkZ, viewRadius)) {
this.getOrCreateTracker(chunkX, chunkZ).addPlayer(player);
}
if (!this.interects(chunkX - deltaChunkX, chunkZ - deltaChunkZ, playerChunkX, playerChunkZ, viewRadius)) {
BlockSystemPlayerTracker tracker = this.getTracker(chunkX - deltaChunkX, chunkZ - deltaChunkZ);
if (tracker != null) {
tracker.removePlayer(player);
}
}
}
}
handler.setManagedPosX(playerPosition.getX());
handler.setManagedPosZ(playerPosition.getZ());
this.markSortPending();
}
}
}
示例4: setPlayerViewRadius
import javax.vecmath.Point3d; //導入方法依賴的package包/類
public void setPlayerViewRadius(int radius) {
radius = MathHelper.clamp(radius, 3, 32);
if (radius != this.playerViewRadius) {
int deltaRadius = radius - this.playerViewRadius;
for (EntityPlayerMP player : Lists.newArrayList(this.players)) {
Point3d playerPosition = this.getUntransformedPosition(player);
int playerChunkX = (int) playerPosition.getX() >> 4;
int playerChunkZ = (int) playerPosition.getZ() >> 4;
if (deltaRadius > 0) {
for (int chunkX = playerChunkX - radius; chunkX <= playerChunkX + radius; ++chunkX) {
for (int chunkZ = playerChunkZ - radius; chunkZ <= playerChunkZ + radius; ++chunkZ) {
BlockSystemPlayerTracker tracker = this.getOrCreateTracker(chunkX, chunkZ);
if (!tracker.containsPlayer(player)) {
tracker.addPlayer(player);
}
}
}
} else {
for (int chunkX = playerChunkX - this.playerViewRadius; chunkX <= playerChunkX + this.playerViewRadius; ++chunkX) {
for (int chunkZ = playerChunkZ - this.playerViewRadius; chunkZ <= playerChunkZ + this.playerViewRadius; ++chunkZ) {
if (!this.interects(chunkX, chunkZ, playerChunkX, playerChunkZ, radius)) {
this.getOrCreateTracker(chunkX, chunkZ).removePlayer(player);
}
}
}
}
}
this.playerViewRadius = radius;
this.markSortPending();
}
}
示例5: getClosestPlayer
import javax.vecmath.Point3d; //導入方法依賴的package包/類
@Override
public EntityPlayer getClosestPlayer(double posX, double posY, double posZ, double distance, boolean spectator) {
Point3d transformed = this.getTransformedPosition(new Point3d(posX, posY, posZ));
posX = transformed.getX();
posY = transformed.getY();
posZ = transformed.getZ();
return this.mainWorld.getClosestPlayer(posX, posY, posZ, distance, spectator);
}
示例6: getNearestAttackablePlayer
import javax.vecmath.Point3d; //導入方法依賴的package包/類
@Override
public EntityPlayer getNearestAttackablePlayer(double posX, double posY, double posZ, double maxXZDistance, double maxYDistance, Function<EntityPlayer, Double> serializer, Predicate<EntityPlayer> selector) {
Point3d transformed = this.getTransformedPosition(new Point3d(posX, posY, posZ));
posX = transformed.getX();
posY = transformed.getY();
posZ = transformed.getZ();
return this.mainWorld.getNearestAttackablePlayer(posX, posY, posZ, maxXZDistance, maxYDistance, serializer, selector);
}
示例7: spawnParticle
import javax.vecmath.Point3d; //導入方法依賴的package包/類
@Override
public void spawnParticle(EnumParticleTypes particleType, double posX, double posY, double posZ, double xSpeed, double ySpeed, double zSpeed, int... parameters) {
Point3d transformed = this.getTransformedPosition(new Point3d(posX, posY, posZ));
posX = transformed.getX();
posY = transformed.getY();
posZ = transformed.getZ();
if (particleType != EnumParticleTypes.REDSTONE) {
Vec3d transformedVelocity = this.getTransformedVector(new Vec3d(xSpeed, ySpeed, zSpeed));
xSpeed = transformedVelocity.xCoord;
ySpeed = transformedVelocity.yCoord;
zSpeed = transformedVelocity.zCoord;
}
super.spawnParticle(particleType, posX, posY, posZ, xSpeed, ySpeed, zSpeed, parameters);
}
示例8: playSound
import javax.vecmath.Point3d; //導入方法依賴的package包/類
@Override
public void playSound(EntityPlayer player, double x, double y, double z, SoundEvent sound, SoundCategory category, float volume, float pitch) {
Point3d transformed = this.getTransformedPosition(new Point3d(x, y, z));
x = transformed.getX();
y = transformed.getY();
z = transformed.getZ();
super.playSound(player, x, y, z, sound, category, volume, pitch);
}
示例9: transformEffect
import javax.vecmath.Point3d; //導入方法依賴的package包/類
public static void transformEffect(Particle particle) {
BlockSystem transforming = BlockSystem.transforming;
if (transforming != null) {
Point3d transformed = transforming.getTransformedPosition(new Point3d(particle.posX, particle.posY, particle.posZ));
particle.setPosition(transformed.getX(), transformed.getY(), transformed.getZ());
particle.prevPosX = transformed.getX();
particle.prevPosY = transformed.getY();
particle.prevPosZ = transformed.getZ();
Vec3d transformedVelocity = transforming.getTransformedVector(new Vec3d(particle.motionX, particle.motionY, particle.motionZ));
particle.motionX = transformedVelocity.xCoord;
particle.motionY = transformedVelocity.yCoord;
particle.motionZ = transformedVelocity.zCoord;
}
}
示例10: projection
import javax.vecmath.Point3d; //導入方法依賴的package包/類
public static Point2D projection(Point3d point) {
return new Point2D.Double(point.getX(), point.getY());
}
示例11: getTransformedPosition
import javax.vecmath.Point3d; //導入方法依賴的package包/類
public Vec3d getTransformedPosition(Vec3d position) {
Point3d point = new Point3d(position.xCoord - 0.5, position.yCoord, position.zCoord - 0.5);
this.transformMatrix.transform(point);
return new Vec3d(point.getX(), point.getY(), point.getZ());
}
示例12: getUntransformedPosition
import javax.vecmath.Point3d; //導入方法依賴的package包/類
public Vec3d getUntransformedPosition(Vec3d position) {
Point3d point = new Point3d(position.xCoord, position.yCoord, position.zCoord);
this.untransformMatrix.transform(point);
return new Vec3d(point.getX() + 0.5, point.getY(), point.getZ() + 0.5);
}
示例13: transformPoint
import javax.vecmath.Point3d; //導入方法依賴的package包/類
public Vec3d transformPoint(Vec3d vec) {
Point3d point = new Point3d(vec.xCoord, vec.yCoord, vec.zCoord);
this.transform(point);
return new Vec3d(point.getX(), point.getY(), point.getZ());
}