Examples of Vector3i


Examples of org.terasology.math.Vector3i

        // TODO: This will only work for tall mobs/players and single block mobs
        // is this a different position than previously
        if (!oldPosition.equals(newPosition)) {
            // get the old position's blocks
            Block[] oldBlocks = new Block[(int) Math.ceil(characterHeight)];
            Vector3i currentPosition = oldPosition.clone();
            for (int currentHeight = 0; currentHeight < oldBlocks.length; currentHeight++) {
                oldBlocks[currentHeight] = worldProvider.getBlock(currentPosition);
                currentPosition.add(0, 1, 0);
            }

            // get the new position's blocks
            Block[] newBlocks = new Block[(int) Math.ceil(characterHeight)];
            currentPosition = newPosition.clone();
            for (int currentHeight = 0; currentHeight < characterHeight; currentHeight++) {
                newBlocks[currentHeight] = worldProvider.getBlock(currentPosition);
                currentPosition.add(0, 1, 0);
            }

            for (int i = 0; i < characterHeight; i++) {
                // send a block enter/leave event for this character
                entity.send(new OnEnterBlockEvent(oldBlocks[i], newBlocks[i], new Vector3i(0, i, 0)));
            }
        }
    }
View Full Code Here

Examples of org.terasology.math.Vector3i

            for (Vector3f side : sides) {
                Block block = worldProvider.getBlock(side);
                if (block.isClimbable()) {
                    //If any of our sides are near a climbable block, check if we are near to the side
                    Vector3i myPos = new Vector3i(worldPos, 0.5f);
                    Vector3i climbBlockPos = new Vector3i(side, 0.5f);
                    Vector3i dir = block.getDirection().getVector3i().clone();
                    float currentDistance = 10f;

                    if (dir.x != 0 && Math.abs(worldPos.x - (float) climbBlockPos.x + (float) dir.x * .5f) < movementComp.radius + 0.1f) {
                        newClimbing = true;
                        if (myPos.x < climbBlockPos.x) {
View Full Code Here

Examples of org.terasology.math.Vector3i

            return;
        }
        Quat4f rotation = new Quat4f();
        Vector3f tmp;

        Vector3i climbDir3i = state.getClimbDirection();
        Vector3f climbDir3f = climbDir3i.toVector3f();

        QuaternionUtil.setEuler(rotation, TeraMath.DEG_TO_RAD * state.getYaw(), 0, 0);
        tmp = new Vector3f(0.0f, 0.0f, -1.0f);
        QuaternionUtil.quatRotate(rotation, tmp, tmp);
        float angleToClimbDirection = tmp.angle(climbDir3f);
View Full Code Here

Examples of org.terasology.math.Vector3i

*/
public class ChunkStoreId implements StoreId {
    private Vector3i pos;

    public ChunkStoreId(Vector3i pos) {
        this.pos = new Vector3i(pos);
    }
View Full Code Here

Examples of org.terasology.math.Vector3i

        glEnable(GL11.GL_CULL_FACE);
    }

    private void renderBlockParticles(Vector3f worldPos, Vector3f cameraPosition, BlockParticleEffectComponent particleEffect) {

        Vector3i worldPos3i = new Vector3i(worldPos, 0.5f);
        Biome biome = worldProvider.getBiome(worldPos3i);

        glPushMatrix();
        glTranslated(worldPos.x - cameraPosition.x, worldPos.y - cameraPosition.y, worldPos.z - cameraPosition.z);
View Full Code Here

Examples of org.terasology.math.Vector3i

    private String getChunkZipFilename(Vector3i pos) {
        return String.format("%d.%d.%d.chunks.zip", pos.x, pos.y, pos.z);
    }

    public Vector3i getChunkZipPosition(Vector3i chunkPos) {
        Vector3i result = new Vector3i(chunkPos);
        result.divide(CHUNK_ZIP_DIM);
        if (chunkPos.x < 0) {
            result.x -= 1;
        }
        if (chunkPos.y < 0) {
            result.y -= 1;
View Full Code Here

Examples of org.terasology.math.Vector3i

    private EntityData.EntityStore entityStore;
    private TIntSet externalRefs;

    public ChunkStoreInternal(Chunk chunk, StorageManagerInternal storageManager, EngineEntityManager entityManager) {
        this.chunk = chunk;
        this.chunkPosition = new Vector3i(chunk.getPosition());
        this.storageManager = storageManager;
        this.entityManager = entityManager;
    }
View Full Code Here

Examples of org.terasology.math.Vector3i

        this.storageManager = storageManager;
        this.entityManager = entityManager;
    }

    public ChunkStoreInternal(EntityData.ChunkStore chunkData, TIntSet externalRefs, StorageManagerInternal storageManager, EngineEntityManager entityManager) {
        this.chunkPosition = new Vector3i(chunkData.getX(), chunkData.getY(), chunkData.getZ());
        this.storageManager = storageManager;
        this.entityManager = entityManager;

        this.chunk = ChunkSerializer.decode(chunkData);
        this.entityStore = chunkData.getStore();
View Full Code Here

Examples of org.terasology.math.Vector3i

        this.externalRefs = externalRefs;
    }

    @Override
    public Vector3i getChunkPosition() {
        return new Vector3i(chunkPosition);
    }
View Full Code Here

Examples of org.terasology.math.Vector3i

public class Vector3iCopyStrategy implements CopyStrategy<Vector3i> {

    @Override
    public Vector3i copy(Vector3i value) {
        if (value != null) {
            return new Vector3i(value);
        }
        return null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.