本文整理匯總了Java中net.minecraft.entity.MoverType類的典型用法代碼示例。如果您正苦於以下問題:Java MoverType類的具體用法?Java MoverType怎麽用?Java MoverType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MoverType類屬於net.minecraft.entity包,在下文中一共展示了MoverType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: movePlayerDown
import net.minecraft.entity.MoverType; //導入依賴的package包/類
private void movePlayerDown() {
if (!getWorld().isRemote) return;
AxisAlignedBB aabb = new AxisAlignedBB(getPos().getX(), getPos().getY() + 1, getPos().getZ(), getPos().getX() + 1, getPos().getY() + oldExtension + 1.05F, getPos().getZ() + 1);
List<Entity> entityList = getWorld().getEntitiesWithinAABBExcludingEntity(null, aabb);
for (Entity entity : entityList) {
if (entity instanceof EntityPlayer) {
// moveEntityToCenter(entity);
double posX = entity.posX;
double posZ = entity.posZ;
if (posX >= getPos().getX() && posX < getPos().getX() + 1 && posZ >= getPos().getZ() && posZ < getPos().getZ() + 1) {
entity.motionX *= 0.6;
entity.motionZ *= 0.6;
entity.move(MoverType.SELF, 0, extension - oldExtension + 0.001F, 0);
}
}
}
}
示例2: move
import net.minecraft.entity.MoverType; //導入依賴的package包/類
@Override
public void move(MoverType type, double x, double y, double z)
{
if (this.freezeTime <= 0)
{
Vec3i oldPos = new Vec3i((int) Math.floor(this.getPosition().getX()),
(int) Math.floor(this.getPosition().getY()), (int) Math.floor(this.getPosition().getZ()));
super.move(type, x, y, z);
Vec3i newPos = new Vec3i((int) Math.floor(this.getPosition().getX()),
(int) Math.floor(this.getPosition().getY()), (int) Math.floor(this.getPosition().getZ()));
if (!oldPos.equals(newPos))
{
if (world.getBlockState(new BlockPos(oldPos)).getBlock() == ModRegistry.FANCY_LIGHT)
{
world.setBlockToAir(new BlockPos(oldPos));
}
if (world.getBlockState(new BlockPos(newPos)).getBlock() == Blocks.AIR)
{
world.setBlockState(new BlockPos(newPos), ModRegistry.FANCY_LIGHT.getDefaultState());
}
}
} else
{
}
}
示例3: moveEntity
import net.minecraft.entity.MoverType; //導入依賴的package包/類
/**
* Tries to move the entity towards the specified location.
*/
@Override
public void moveEntity(MoverType type, double mx, double my, double mz)
{
double d0 = this.posX;
double d1 = this.posZ;
//-ZMod-Fly---------------------------------------------------------------
ZHandle.handle("beforePlayerMove", new Vec3d(mx,my,mz));
Vec3d motion = new Vec3d(this.motionX, this.motionY, this.motionZ);
//------------------------------------------------------------------------
super.moveEntity(type, mx, my, mz);
// This was in ZMod before
// super.moveEntity(type, this.motionX, this.motionY, this.motionZ);
this.updateAutoJump((float)(this.posX - d0), (float)(this.posZ - d1));
//-ZMod-Fly---------------------------------------------------------------
ZHandle.handle("afterPlayerMove", motion);
//------------------------------------------------------------------------
}
示例4: moveDerailedMinecart
import net.minecraft.entity.MoverType; //導入依賴的package包/類
/**
* Moves a minecart that is not attached to a rail
*/
protected void moveDerailedMinecart()
{
double d0 = this.getMaximumSpeed();
this.motionX = MathHelper.clamp(this.motionX, -d0, d0);
this.motionZ = MathHelper.clamp(this.motionZ, -d0, d0);
if (this.onGround)
{
this.motionX *= 0.5D;
this.motionY *= 0.5D;
this.motionZ *= 0.5D;
}
this.moveEntity(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
if (!this.onGround)
{
this.motionX *= 0.949999988079071D;
this.motionY *= 0.949999988079071D;
this.motionZ *= 0.949999988079071D;
}
}
示例5: moveEntityWithHeading
import net.minecraft.entity.MoverType; //導入依賴的package包/類
/**
* Moves the entity based on the specified heading.
*/
public void moveEntityWithHeading(float strafe, float forward)
{
if (this.isServerWorld() && this.isInWater())
{
this.moveRelative(strafe, forward, 0.1F);
this.moveEntity(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.8999999761581421D;
this.motionY *= 0.8999999761581421D;
this.motionZ *= 0.8999999761581421D;
if (!this.isMoving() && this.getAttackTarget() == null)
{
this.motionY -= 0.005D;
}
}
else
{
super.moveEntityWithHeading(strafe, forward);
}
}
示例6: func_190605_a
import net.minecraft.entity.MoverType; //導入依賴的package包/類
private void func_190605_a(Entity p_190605_1_, EnumFacing p_190605_2_, double p_190605_3_)
{
AxisAlignedBB axisalignedbb = p_190605_1_.getEntityBoundingBox();
AxisAlignedBB axisalignedbb1 = Block.FULL_BLOCK_AABB.offset(this.pos);
if (axisalignedbb.intersectsWith(axisalignedbb1))
{
EnumFacing enumfacing = p_190605_2_.getOpposite();
double d0 = this.func_190612_a(axisalignedbb1, enumfacing, axisalignedbb) + 0.01D;
double d1 = this.func_190612_a(axisalignedbb1, enumfacing, axisalignedbb.func_191500_a(axisalignedbb1)) + 0.01D;
if (Math.abs(d0 - d1) < 0.01D)
{
d0 = Math.min(d0, p_190605_3_) + 0.01D;
field_190613_i.set(p_190605_2_);
p_190605_1_.moveEntity(MoverType.PISTON, d0 * (double)enumfacing.getFrontOffsetX(), d0 * (double)enumfacing.getFrontOffsetY(), d0 * (double)enumfacing.getFrontOffsetZ());
field_190613_i.set((EnumFacing)null);
}
}
}
示例7: updateMovement
import net.minecraft.entity.MoverType; //導入依賴的package包/類
public void updateMovement()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY -= 0.03999999910593033D;
this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (!this.onGround && this.world.isRemote)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
this.motionY *= -0.5D;
}
}
示例8: fixEntityWithinPistonBase
import net.minecraft.entity.MoverType; //導入依賴的package包/類
public void fixEntityWithinPistonBase(Entity entity, EnumFacing side, double p_190605_3_)
{
AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox();
BlockPos pos = getPos();
AxisAlignedBB axisalignedbb1 = Block.FULL_BLOCK_AABB.offset(pos);
if (axisalignedbb.intersectsWith(axisalignedbb1))
{
EnumFacing enumfacing = side.getOpposite();
double d0 = getMovement(axisalignedbb1, enumfacing, axisalignedbb) + 0.01D;
double d1 = getMovement(axisalignedbb1, enumfacing, axisalignedbb.intersect(axisalignedbb1)) + 0.01D;
if (Math.abs(d0 - d1) < 0.01D)
{
d0 = Math.min(d0, p_190605_3_) + 0.1D;
//MOVING_ENTITY.set(p_190605_2_);
entity.move(MoverType.PISTON, d0 * enumfacing.getFrontOffsetX(), d0 * enumfacing.getFrontOffsetY(), d0 * enumfacing.getFrontOffsetZ());
//MOVING_ENTITY.set((EnumFacing)null);
}
}
}
示例9: onBlockPlacedBy
import net.minecraft.entity.MoverType; //導入依賴的package包/類
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
if (!blockHasAlreadyBeenPlaced(stack)) {
if (!world.isRemote) {
generateChessBoard(world, pos, placer, stack);
}
if (placer != null) {
placer.move(MoverType.SELF, 0, 2, 0);
}
} else {
BlockPos a8 = BlockPos.fromLong(stack.getTagCompound().getLong(NBT_A8_KEY));
UUID gameId = stack.getTagCompound().getUniqueId(NBT_GAME_ID_KEY);
setGameDataToTileEntity(world, pos, a8, gameId);
}
}
示例10: onUpdate
import net.minecraft.entity.MoverType; //導入依賴的package包/類
@Override
public void onUpdate () {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY -= 0.03999999910593033D;
move(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (this.onGround) {
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
this.motionY *= -0.5D;
}
if (this.fuse-- <= 0) {
setDead();
if (!this.world.isRemote) explode();
} else
this.world.spawnParticle(EnumParticleTypes.FLAME, this.posX, this.posY, this.posZ, Utils.randomWithRange(-0.05D, 0.05D), 0.1D, Utils.randomWithRange(-0.05D, 0.005D));
}
示例11: moveEntityLinear
import net.minecraft.entity.MoverType; //導入依賴的package包/類
private void moveEntityLinear(Entity entity)
{
if (entity == null)
{
Multishot.logger.fatal("movePlayerLinear(): player was null");
return;
}
double mx, my, mz;
float yaw, pitch;
mx = Configs.getMotionX();
mz = Configs.getMotionZ();
my = Configs.getMotionY();
yaw = Configs.getRotationYaw();
pitch = Configs.getRotationPitch();
//player.setPositionAndUpdate(pos.xCoord + x, pos.yCoord + y, pos.zCoord + z); // Does strange things...
//player.setVelocity(mx, my, mz); // Doesn't work for values < 0.005
//Vec3 pos = player.getPosition(1.0f);
//player.setPositionAndRotation(pos.xCoord + mx, pos.yCoord + my, pos.zCoord + mz, player.rotationYaw + yaw, player.rotationPitch + pitch);
entity.move(MoverType.SELF, mx, my, mz);
//p.setPositionAndRotation(p.posX + mx, p.posY + my, p.posZ + mz, p.rotationYaw, p.rotationPitch);
this.reOrientEntityToAngle(entity, entity.rotationYaw + yaw, entity.rotationPitch + pitch);
}
示例12: moveEntityCircular
import net.minecraft.entity.MoverType; //導入依賴的package包/類
private void moveEntityCircular(Entity entity)
{
if (entity == null)
{
Multishot.logger.fatal("movePlayerCircular(): player was null");
return;
}
this.circleCurrentAngle += this.circleAngularVelocity;
double x = this.circleCenter.getX() - Math.sin(this.circleCurrentAngle) * this.circleRadius;
double z = this.circleCenter.getZ() + Math.cos(this.circleCurrentAngle) * this.circleRadius;
x = (x - entity.posX);
z = (z - entity.posZ);
entity.move(MoverType.SELF, x, 0.0, z);
//p.setPositionAndRotation(x, p.posY, z, p.rotationYaw, p.rotationPitch);
// If we have a target point set, re-orient the player to look at the target point
if (this.getUseTarget())
{
this.reOrientEntityToTargetPoint(entity, this.circleTarget);
}
}
示例13: updateMovement
import net.minecraft.entity.MoverType; //導入依賴的package包/類
private void updateMovement()
{
if (this.hasNoGravity() == false)
{
this.motionY -= 0.04D;
}
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.98D;
this.motionY *= 0.98D;
this.motionZ *= 0.98D;
}
示例14: update
import net.minecraft.entity.MoverType; //導入依賴的package包/類
public void update() {
double dx = targetX - posX;
double dy = targetY - posY;
double dz = targetZ - posZ;
final double lenSq = dx * dx + dy * dy + dz * dz;
if (shouldJump(lenSq)) {
setPositionRaw(targetX, targetY, targetZ);
motionX = motionY = motionZ = 0;
} else {
if (lenSq > cutoff * cutoff) {
double scale = cutoff / Math.sqrt(lenSq);
dx *= scale;
dy *= scale;
dz *= scale;
}
move(MoverType.SELF, motionX + dx * damp, motionY + dy * damp, motionZ + dz * damp);
}
}
示例15: setSize
import net.minecraft.entity.MoverType; //導入依賴的package包/類
@Override
public void setSize(float width, float height)
{
float f2 = this.width;
this.width = width;
this.height = height;
if(blocks == null)
{
this.setEntityBoundingBox(new AxisAlignedBB(this.getEntityBoundingBox().minX, this.getEntityBoundingBox().minY, this.getEntityBoundingBox().minZ, this.getEntityBoundingBox().minX + (double)this.width, this.getEntityBoundingBox().minY + (double)this.height, this.getEntityBoundingBox().minZ + (double)this.width));
}
else
{
this.setEntityBoundingBox(new AxisAlignedBB(this.getEntityBoundingBox().minX, this.getEntityBoundingBox().minY, this.getEntityBoundingBox().minZ, this.getEntityBoundingBox().minX + (double)(blocks.length - 0.05F), this.getEntityBoundingBox().minY + (double)(blocks[0].length - 0.05F), this.getEntityBoundingBox().minZ + (double)(blocks[0][0].length - 0.05F)));
}
if(this.width > f2 && !this.firstUpdate && !this.world.isRemote)
{
this.move(MoverType.SELF, (double)(f2 - this.width), 0.0D, (double)(f2 - this.width));
}
}