Package org.terasology.world.block

Examples of org.terasology.world.block.BlockUri


            if (blockFamily.getBlockIdCount() != blockFamily.getBlockUriCount()) {
                logger.error("Received block registration with mismatched id<->uri mapping");
            } else if (blockFamily.getBlockUriCount() == 0) {
                logger.error("Received empty block registration");
            } else {
                BlockUri family = new BlockUri(blockFamily.getBlockUri(0)).getFamilyUri();
                Map<String, Integer> registrationMap = Maps.newHashMap();
                for (int i = 0; i < blockFamily.getBlockIdCount(); ++i) {
                    registrationMap.put(blockFamily.getBlockUri(i), blockFamily.getBlockId(i));
                }
                blockManager.receiveFamilyRegistration(family, registrationMap);
View Full Code Here


        when(networkSystem.getPlayers()).thenReturn(Arrays.asList(client));

        BlockManagerImpl blockManager = CoreRegistry.put(BlockManager.class, new BlockManagerImpl(mock(WorldAtlas.class), new DefaultBlockFamilyFactoryRegistry()));
        testBlock = new Block();
        testBlock.setId((short) 1);
        blockManager.addBlockFamily(new SymmetricFamily(new BlockUri("test:testblock"), testBlock), true);
        testBlock2 = new Block();
        testBlock2.setId((short) 2);
        blockManager.addBlockFamily(new SymmetricFamily(new BlockUri("test:testblock2"), testBlock2), true);

        esm = new StorageManagerInternal(moduleManager.getEnvironment(), entityManager, false);
        CoreRegistry.put(StorageManager.class, esm);

        ComponentSystemManager componentSystemManager = new ComponentSystemManager();
View Full Code Here

        BlockManagerImpl blockManager = new BlockManagerImpl(new NullWorldAtlas(), new DefaultBlockFamilyFactoryRegistry());
        CoreRegistry.put(BlockManager.class, blockManager);
        airBlock = BlockManager.getAir();
        solidBlock = new Block();
        solidBlock.setDisplayName("Stone");
        solidBlock.setUri(new BlockUri("engine:stone"));
        solidBlock.setId((short) 1);
        for (Side side : Side.values()) {
            solidBlock.setFullSide(side, true);
        }
        solidBlock.setTranslucent(false);
        blockManager.addBlockFamily(new SymmetricFamily(solidBlock.getURI(), solidBlock), true);

        fullLight = new Block();
        fullLight.setDisplayName("Torch");
        fullLight.setUri(new BlockUri("engine:torch"));
        fullLight.setId((short) 2);
        fullLight.setLuminance(ChunkConstants.MAX_LIGHT);
        blockManager.addBlockFamily(new SymmetricFamily(fullLight.getURI(), fullLight), true);
    }
View Full Code Here

        BlockManagerImpl blockManager = new BlockManagerImpl(new NullWorldAtlas(), new DefaultBlockFamilyFactoryRegistry());
        CoreRegistry.put(BlockManager.class, blockManager);
        airBlock = BlockManager.getAir();
        solidBlock = new Block();
        solidBlock.setDisplayName("Stone");
        solidBlock.setUri(new BlockUri("engine:stone"));
        blockManager.addBlockFamily(new SymmetricFamily(solidBlock.getURI(), solidBlock), true);
        solidBlock = blockManager.getBlock(solidBlock.getURI());
    }
View Full Code Here

        blockManager = new BlockManagerImpl(new NullWorldAtlas(),
                Lists.<String>newArrayList(), Maps.<String, Short>newHashMap(), true, new DefaultBlockFamilyFactoryRegistry());
        CoreRegistry.put(BlockManager.class, blockManager);
        fullLight = new Block();
        fullLight.setDisplayName("Torch");
        fullLight.setUri(new BlockUri("engine:torch"));
        fullLight.setId((short) 2);
        fullLight.setLuminance(ChunkConstants.MAX_LIGHT);
        blockManager.addBlockFamily(new SymmetricFamily(fullLight.getURI(), fullLight), true);

        weakLight = new Block();
        weakLight.setDisplayName("PartLight");
        weakLight.setUri(new BlockUri("engine:weakLight"));
        weakLight.setId((short) 3);
        weakLight.setLuminance((byte) 2);
        blockManager.addBlockFamily(new SymmetricFamily(weakLight.getURI(), weakLight), true);

        mediumLight = new Block();
        mediumLight.setDisplayName("MediumLight");
        mediumLight.setUri(new BlockUri("engine:mediumLight"));
        mediumLight.setId((short) 4);
        mediumLight.setLuminance((byte) 5);
        blockManager.addBlockFamily(new SymmetricFamily(mediumLight.getURI(), mediumLight), true);

        solid = new Block();
        solid.setDisplayName("Solid");
        solid.setUri(new BlockUri("engine:solid"));
        solid.setId((short) 5);
        for (Side side : Side.values()) {
            solid.setFullSide(side, true);
        }
        blockManager.addBlockFamily(new SymmetricFamily(solid.getURI(), solid), true);

        solidMediumLight = new Block();
        solidMediumLight.setDisplayName("SolidMediumLight");
        solidMediumLight.setUri(new BlockUri("engine:solidMediumLight"));
        solidMediumLight.setId((short) 6);
        solidMediumLight.setLuminance((byte) 5);
        for (Side side : Side.values()) {
            solidMediumLight.setFullSide(side, true);
        }
View Full Code Here

                Lists.<String>newArrayList(), Maps.<String, Short>newHashMap(), true, new DefaultBlockFamilyFactoryRegistry());
        CoreRegistry.put(BlockManager.class, blockManager);

        solid = new Block();
        solid.setDisplayName("Solid");
        solid.setUri(new BlockUri("engine:solid"));
        solid.setId((short) 5);
        for (Side side : Side.values()) {
            solid.setFullSide(side, true);
        }
        blockManager.addBlockFamily(new SymmetricFamily(solid.getURI(), solid), true);
View Full Code Here

                Lists.<String>newArrayList(), Maps.<String, Short>newHashMap(), true, new DefaultBlockFamilyFactoryRegistry());
        CoreRegistry.put(BlockManager.class, blockManager);

        solid = new Block();
        solid.setDisplayName("Solid");
        solid.setUri(new BlockUri("engine:solid"));
        solid.setId((short) 5);
        for (Side side : Side.values()) {
            solid.setFullSide(side, true);
        }
        blockManager.addBlockFamily(new SymmetricFamily(solid.getURI(), solid), true);
View Full Code Here

        entityManager = builder.build(moduleManager.getEnvironment(), networkSystem, new ReflectionReflectFactory());
        worldStub = new WorldProviderCoreStub();
        worldProvider = new EntityAwareWorldProvider(worldStub, entityManager);

        plainBlock = new Block();
        blockManager.addBlockFamily(new SymmetricFamily(new BlockUri("test:plainBlock"), plainBlock), true);

        blockWithString = new Block();
        PrefabData prefabData = new PrefabData();
        prefabData.addComponent(new StringComponent("Test"));
        Assets.generateAsset(new AssetUri(AssetType.PREFAB, "test:prefabWithString"), prefabData, Prefab.class);
        blockWithString.setPrefab("test:prefabWithString");
        blockManager.addBlockFamily(new SymmetricFamily(new BlockUri("test:blockWithString"), blockWithString), true);

        blockWithDifferentString = new Block();
        prefabData = new PrefabData();
        prefabData.addComponent(new StringComponent("Test2"));
        Assets.generateAsset(
                new AssetUri(AssetType.PREFAB, "test:prefabWithDifferentString"), prefabData, Prefab.class);
        blockWithDifferentString.setPrefab("test:prefabWithDifferentString");
        blockManager.addBlockFamily(new SymmetricFamily(new BlockUri("test:blockWithDifferentString"), blockWithDifferentString), true);

        blockWithRetainedComponent = new Block();
        prefabData = new PrefabData();
        prefabData.addComponent(new RetainedOnBlockChangeComponent(3));
        Assets.generateAsset(
                new AssetUri(AssetType.PREFAB, "test:prefabWithRetainedComponent"), prefabData, Prefab.class);
        blockWithRetainedComponent.setPrefab("test:prefabWithRetainedComponent");
        blockManager.addBlockFamily(new SymmetricFamily(new BlockUri("test:blockWithRetainedComponent"), blockWithRetainedComponent), true);

        blockInFamilyOne = new Block();
        blockInFamilyOne.setKeepActive(true);
        blockInFamilyOne.setPrefab("test:prefabWithString");
        blockInFamilyTwo = new Block();
        blockInFamilyTwo.setPrefab("test:prefabWithString");
        blockInFamilyTwo.setKeepActive(true);
        blockManager.addBlockFamily(new HorizontalBlockFamily(new BlockUri("test:blockFamily"),
                ImmutableMap.<Side, Block>of(Side.FRONT, blockInFamilyOne, Side.LEFT, blockInFamilyTwo, Side.RIGHT, blockInFamilyTwo, Side.BACK, blockInFamilyOne),
                Collections.<String>emptyList()), true);

        keepActiveBlock = new Block();
        keepActiveBlock.setKeepActive(true);
        keepActiveBlock.setPrefab("test:prefabWithString");
        blockManager.addBlockFamily(new SymmetricFamily(new BlockUri("test:keepActiveBlock"), keepActiveBlock), true);

        worldProvider.initialise();
    }
View Full Code Here

    @Test
    public void testActiveBlockNotCleanedUp() {
        Block testBlock = new Block();
        testBlock.setKeepActive(true);
        BlockFamily blockFamily = new SymmetricFamily(new BlockUri("test:keepActive"), testBlock);
        blockManager.addBlockFamily(blockFamily, true);
        worldStub.setBlock(Vector3i.zero(), testBlock);

        BlockEventChecker checker = new BlockEventChecker();
        entityManager.getEventSystem().registerEventHandler(checker);
View Full Code Here

    }

    @Test
    public void testChangeBlock() {

        blockManager.addBlockFamily(new SymmetricFamily(new BlockUri("some:uri"), new Block()), false);
        Block block = blockManager.getBlock("some:uri");
        chunk.setBlock(new Vector3i(1, 2, 3), block);
        assertEquals(block, chunk.getBlock(new Vector3i(1, 2, 3)));
    }
View Full Code Here

TOP

Related Classes of org.terasology.world.block.BlockUri

Copyright © 2018 www.massapicom. 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.