Examples of Vector3i


Examples of org.terasology.math.Vector3i

        this.hit = true;
        this.entity = entity;
        this.hitPoint = hitPoint;
        this.hitNormal = hitNormal;
        //This is the block were the hitPoint is inside:
        this.blockPosition = new Vector3i(hitPoint, 0.5f);
        this.worldHit = false;
    }
View Full Code Here

Examples of org.terasology.math.Vector3i

    }

    private float[] getSubset(float[] fullData, Region3i fullRegion, Region3i subRegion) {
        if (subRegion.size().x != fullRegion.size().x || subRegion.size().y != fullRegion.size().y || subRegion.size().z != fullRegion.size().z) {
            float[] result = new float[subRegion.size().x * subRegion.size().y * subRegion.size().z];
            Vector3i offset = new Vector3i(subRegion.minX() - fullRegion.minX(), subRegion.minY() - fullRegion.minY(), subRegion.minZ() - fullRegion.minZ());
            for (int z = 0; z < subRegion.size().z; ++z) {
                for (int y = 0; y < subRegion.size().y; ++y) {
                    System.arraycopy(fullData, offset.x + fullRegion.sizeX() * (y + offset.y + fullRegion.sizeY() * (z + offset.z)),
                            result, subRegion.sizeX() * (y + subRegion.sizeY() * z), subRegion.size().x);
                }
View Full Code Here

Examples of org.terasology.math.Vector3i

        int newMinY = region.minY() - IntMath.mod(region.minY(), sampleRate);
        int newMinZ = region.minZ() - IntMath.mod(region.minZ(), sampleRate);
        int newMaxX = region.maxX() + 4 - IntMath.mod(region.maxX(), sampleRate) - 1;
        int newMaxY = region.maxY() + 4 - IntMath.mod(region.maxY(), sampleRate) - 1;
        int newMaxZ = region.maxZ() + 4 - IntMath.mod(region.maxZ(), sampleRate) - 1;
        return Region3i.createFromMinMax(new Vector3i(newMinX, newMinY, newMinZ), new Vector3i(newMaxX, newMaxY, newMaxZ));
    }
View Full Code Here

Examples of org.terasology.math.Vector3i

        EVENT_BUS.post(event);
    }

    private static synchronized ChunkMonitorEntry registerChunk(Chunk chunk) {
        Preconditions.checkNotNull(chunk, "The parameter 'chunk' must not be null");
        final Vector3i pos = chunk.getPosition();
        ChunkMonitorEntry entry = CHUNKS.get(pos);
        if (entry == null) {
            entry = new ChunkMonitorEntry(pos);
            CHUNKS.put(pos, entry);
        }
View Full Code Here

Examples of org.terasology.math.Vector3i

        for (NetData.BlockChangeMessage blockChange : message.getBlockChangeList()) {
            Block newBlock = blockManager.getBlock((short) blockChange.getNewBlock());
            logger.debug("Received block change to {}", newBlock);
            // TODO: Store changes to blocks that aren't ready to be modified (the surrounding chunks aren't available)
            WorldProvider worldProvider = CoreRegistry.get(WorldProvider.class);
            Vector3i pos = NetMessageUtil.convert(blockChange.getPos());
            if (worldProvider.isBlockRelevant(pos)) {
                worldProvider.setBlock(pos, newBlock);
            } else {
                awaitingChunkReadyBlockUpdates.put(TeraMath.calcChunkPos(pos), blockChange);
            }
View Full Code Here

Examples of org.terasology.math.Vector3i

            }
        }
    }

    public Vector3i getPosition() {
        return new Vector3i(pos);
    }
View Full Code Here

Examples of org.terasology.math.Vector3i

    private void processBiomeChanges(NetData.NetMessage message) {
        for (NetData.BiomeChangeMessage biomeChange : message.getBiomeChangeList()) {
            logger.debug("Received block change to {}", blockManager.getBlock((short) biomeChange.getNewBiome()));
            // TODO: Store changes to blocks that aren't ready to be modified (the surrounding chunks aren't available)
            WorldProvider worldProvider = CoreRegistry.get(WorldProvider.class);
            Vector3i pos = NetMessageUtil.convert(biomeChange.getPos());
            if (worldProvider.isBlockRelevant(pos)) {
                Biome newBiome = biomeManager.getBiomeByShortId((short) biomeChange.getNewBiome());
                worldProvider.setBiome(pos, newBiome);
            } else {
                awaitingChunkReadyBiomeUpdates.put(TeraMath.calcChunkPos(pos), biomeChange);
View Full Code Here

Examples of org.terasology.math.Vector3i

        }
    }

    private void processInvalidatedChunks(NetData.NetMessage message) {
        for (NetData.InvalidateChunkMessage chunk : message.getInvalidateChunkList()) {
            Vector3i chunkPos = NetMessageUtil.convert(chunk.getPos());
            remoteWorldProvider.invalidateChunks(chunkPos);
            awaitingChunkReadyBlockUpdates.removeAll(chunkPos);
            awaitingChunkReadyBiomeUpdates.removeAll(chunkPos);
        }
    }
View Full Code Here

Examples of org.terasology.math.Vector3i

    public void onChunkReady(Vector3i chunkPos) {
        WorldProvider worldProvider = CoreRegistry.get(WorldProvider.class);

        List<NetData.BlockChangeMessage> updateBlockMessages = awaitingChunkReadyBlockUpdates.removeAll(chunkPos);
        for (NetData.BlockChangeMessage message : updateBlockMessages) {
            Vector3i pos = NetMessageUtil.convert(message.getPos());
            Block newBlock = blockManager.getBlock((short) message.getNewBlock());
            worldProvider.setBlock(pos, newBlock);
        }

        List<NetData.BiomeChangeMessage> updateBiomeMessages = awaitingChunkReadyBiomeUpdates.removeAll(chunkPos);
        for (NetData.BiomeChangeMessage message : updateBiomeMessages) {
            Vector3i pos = NetMessageUtil.convert(message.getPos());
            Biome newBiome = biomeManager.getBiomeByShortId((short) message.getNewBiome());
            worldProvider.setBiome(pos, newBiome);
        }
    }
View Full Code Here

Examples of org.terasology.math.Vector3i

        result.setSequenceNumber(input.getSequenceNumber());
        if (worldProvider.isBlockRelevant(initial.getPosition())) {
            updatePosition(characterMovementComponent, result, input, entity);

            if (input.isFirstRun()) {
                checkBlockEntry(entity, new Vector3i(initial.getPosition(), 0.5f), new Vector3i(result.getPosition(), 0.5f), characterMovementComponent.height);
            }

            if (result.getMode() != MovementMode.GHOSTING && result.getMode() != MovementMode.NONE) {
                checkMode(characterMovementComponent, result, initial, entity, input.isFirstRun());
            }
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.