Example usage for org.apache.commons.math3.geometry.euclidean.threed Vector3D getZ

List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Vector3D getZ

Introduction

In this page you can find the example usage for org.apache.commons.math3.geometry.euclidean.threed Vector3D getZ.

Prototype

public double getZ() 

Source Link

Document

Get the height of the vector.

Usage

From source file:nova.core.wrapper.mc.forge.v17.network.netty.MCNetworkManager.java

public void sendToAllAround(PacketAbstract message, World world, Vector3D point, double range) {
    sendToAllAround(message, world, point.getX(), point.getY(), point.getZ(), range);
}

From source file:nova.core.wrapper.mc.forge.v17.wrapper.block.forward.FWBlock.java

public Block getBlockInstance(net.minecraft.world.IBlockAccess access, Vector3D position) {
    /**//from  w  w  w .  j  a  v  a  2s . c o m
     * If this block has a TileEntity, forward the method into the Stateful
     * block. Otherwise, create a new instance of the block and forward the
     * methods over.
     */
    if (hasTileEntity(0)) {
        FWTile tileWrapper = (FWTile) access.getTileEntity((int) position.getX(), (int) position.getY(),
                (int) position.getZ());
        if (tileWrapper != null && tileWrapper.getBlock() != null) {
            return tileWrapper.getBlock();
        }

        System.out.println("Error: Block in TileWrapper is null.");
    }
    return getBlockInstance((nova.core.world.World) Game.natives().toNova(access), position);

}

From source file:nova.core.wrapper.mc.forge.v17.wrapper.block.world.BWWorld.java

@Override
public void markStaticRender(Vector3D position) {
    world().markBlockForUpdate((int) position.getX(), (int) position.getY(), (int) position.getZ());
}

From source file:nova.core.wrapper.mc.forge.v17.wrapper.block.world.BWWorld.java

@Override
public void markChange(Vector3D position) {
    world().notifyBlockChange((int) position.getX(), (int) position.getY(), (int) position.getZ(),
            access.getBlock((int) position.getX(), (int) position.getY(), (int) position.getZ()));
}

From source file:nova.core.wrapper.mc.forge.v17.wrapper.block.world.BWWorld.java

@Override
public Optional<Block> getBlock(Vector3D position) {
    net.minecraft.block.Block mcBlock = access.getBlock((int) position.getX(), (int) position.getY(),
            (int) position.getZ());
    if (mcBlock == null || mcBlock == Blocks.air) {
        Block airBlock = Game.blocks().getAirBlock().build();
        airBlock.components.add(new MCBlockTransform(airBlock, this, position));
        return Optional.of(airBlock);
    } else if (mcBlock instanceof FWBlock) {
        return Optional.of(((FWBlock) mcBlock).getBlockInstance(access, position));
    } else {/* www .j a v  a  2s  .  c om*/
        return Optional.of(new BWBlock(mcBlock, this, position));
    }
}

From source file:nova.core.wrapper.mc.forge.v17.wrapper.block.world.BWWorld.java

@Override
public boolean setBlock(Vector3D position, BlockFactory blockFactory) {
    //TODO: Implement object arguments
    net.minecraft.block.Block mcBlock = Game.natives().toNative(blockFactory.build());
    return world().setBlock((int) position.getX(), (int) position.getY(), (int) position.getZ(),
            mcBlock != null ? mcBlock : Blocks.air);
}

From source file:nova.core.wrapper.mc.forge.v17.wrapper.block.world.BWWorld.java

@Override
public boolean removeBlock(Vector3D position) {
    return world().setBlockToAir((int) position.getX(), (int) position.getY(), (int) position.getZ());
}

From source file:nova.core.wrapper.mc.forge.v17.wrapper.block.world.BWWorld.java

@Override
public Entity addEntity(Vector3D position, Item item) {
    EntityItem entityItem = new EntityItem(world(), position.getX(), position.getY(), position.getZ(),
            Game.natives().toNative(item));
    world().spawnEntityInWorld(entityItem);
    return new BWEntity(entityItem);
}

From source file:nova.core.wrapper.mc.forge.v17.wrapper.block.world.BWWorld.java

@Override
public void playSoundAtPosition(Vector3D position, Sound sound) {
    world().playSound(position.getX(), position.getY(), position.getZ(), sound.getID(), sound.pitch,
            sound.volume, false);//from w  ww  .  ja v a 2  s . c  o  m
}

From source file:nova.core.wrapper.mc.forge.v17.wrapper.entity.forward.BWRigidBody.java

void updateTranslation(double deltaTime) {
    //Integrate velocity to displacement
    Vector3D displacement = velocity().scalarMultiply(deltaTime);
    mcEntity().moveEntity(displacement.getX(), displacement.getY(), displacement.getZ());

    //Integrate netForce to velocity
    setVelocity(velocity().add(netForce.scalarMultiply(1 / mass()).scalarMultiply(deltaTime)));

    //Clear net force
    netForce = Vector3D.ZERO;//  www .  j  a v  a 2  s . co  m

    //Apply drag
    addForce(velocity().negate().scalarMultiply(drag()));
    if (!mcEntity().onGround) {
        //Apply gravity
        addForce(gravity().scalarMultiply(mass()));
    }
}