Search in sources :

Example 1 with StubPaletteType

use of org.spongepowered.common.test.stub.world.schematic.StubPaletteType in project SpongeCommon by SpongePowered.

the class VolumeTransformationTest method setup.

@BeforeAll
static void setup() {
    VolumeTransformationTest.guice.injectMembers(new DummyInjectable());
    final StubGame game = (StubGame) Sponge.game();
    final SpongeFactoryProvider factoryProvider = game.factoryProvider();
    final SpongeBuilderProvider builderProvider = game.builderProvider();
    // Set up Rotations
    final StubbedRegistry<Rotation> rotation = new StubbedRegistry<>(() -> RegistryTypes.ROTATION, (k) -> Rotations.NONE.get());
    // Set up Blocks and BlockState
    final StubbedRegistry<BlockType> blocktypes = new StubbedRegistry<>(() -> RegistryTypes.BLOCK_TYPE, StubBlock::new);
    // Set up biomes
    final StubbedRegistry<Biome> biomes = new StubbedRegistry<>(() -> RegistryTypes.BIOME, (key) -> Mockito.mock(Biome.class));
    // Set up palettes
    final StubbedRegistry<PaletteType<?, ?>> paletteTypeRegistry = new StubbedRegistry<>(() -> RegistryTypes.PALETTE_TYPE, (key) -> new StubPaletteType<>());
    factoryProvider.registerFactory(RegistryType.Factory.class, new SpongeRegistryType.FactoryImpl());
    factoryProvider.registerFactory(RegistryKey.Factory.class, new SpongeRegistryKey.FactoryImpl());
    factoryProvider.registerFactory(PaletteReference.Factory.class, new SpongePaletteReferenceFactory());
    // and finally, set up the resourcekey stuff
    factoryProvider.registerFactory(ResourceKey.Factory.class, new StubRegistryFactory());
    game.register(rotation);
    game.register(blocktypes);
    game.register(biomes);
    game.register(paletteTypeRegistry);
    final StubbedRegistry<Mirror> mirror = new StubbedRegistry<>(() -> RegistryTypes.MIRROR, (k) -> Mockito.mock(Mirror.class));
    StubMirror.registerDefaults(mirror);
    game.register(mirror);
    builderProvider.register(Transformation.Builder.class, SpongeTransformationBuilder::new);
    builderProvider.register(StreamOptions.Builder.class, SpongeStreamOptionsBuilder::new);
    StubRotations.registerDefaults(rotation);
    paletteTypeRegistry.register(new StubKey("sponge", "block_state_palette"), new StubBlockStatePaletteType());
}
Also used : SpongeFactoryProvider(org.spongepowered.common.registry.SpongeFactoryProvider) Transformation(org.spongepowered.api.util.transformation.Transformation) StubKey(org.spongepowered.common.test.stub.StubKey) StreamOptions(org.spongepowered.api.world.volume.stream.StreamOptions) PaletteType(org.spongepowered.api.world.schematic.PaletteType) StubBlockStatePaletteType(org.spongepowered.common.test.stub.world.schematic.StubBlockStatePaletteType) StubPaletteType(org.spongepowered.common.test.stub.world.schematic.StubPaletteType) PaletteReference(org.spongepowered.api.world.schematic.PaletteReference) Biome(org.spongepowered.api.world.biome.Biome) SpongeRegistryType(org.spongepowered.common.registry.SpongeRegistryType) SpongeRegistryKey(org.spongepowered.common.registry.SpongeRegistryKey) StubBlock(org.spongepowered.common.test.stub.block.StubBlock) SpongeStreamOptionsBuilder(org.spongepowered.common.world.volume.stream.SpongeStreamOptionsBuilder) StubGame(org.spongepowered.common.test.stub.StubGame) StubRegistryFactory(org.spongepowered.common.test.stub.registry.StubRegistryFactory) SpongeRegistryType(org.spongepowered.common.registry.SpongeRegistryType) RegistryType(org.spongepowered.api.registry.RegistryType) SpongeBuilderProvider(org.spongepowered.common.registry.SpongeBuilderProvider) Rotation(org.spongepowered.api.util.rotation.Rotation) StubbedRegistry(org.spongepowered.common.test.stub.registry.StubbedRegistry) StubBlockStatePaletteType(org.spongepowered.common.test.stub.world.schematic.StubBlockStatePaletteType) ResourceKey(org.spongepowered.api.ResourceKey) BlockType(org.spongepowered.api.block.BlockType) Mirror(org.spongepowered.api.util.mirror.Mirror) StubMirror(org.spongepowered.common.test.stub.util.StubMirror) RegistryKey(org.spongepowered.api.registry.RegistryKey) SpongeRegistryKey(org.spongepowered.common.registry.SpongeRegistryKey) SpongePaletteReferenceFactory(org.spongepowered.common.world.schematic.SpongePaletteReferenceFactory) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

BeforeAll (org.junit.jupiter.api.BeforeAll)1 ResourceKey (org.spongepowered.api.ResourceKey)1 BlockType (org.spongepowered.api.block.BlockType)1 RegistryKey (org.spongepowered.api.registry.RegistryKey)1 RegistryType (org.spongepowered.api.registry.RegistryType)1 Mirror (org.spongepowered.api.util.mirror.Mirror)1 Rotation (org.spongepowered.api.util.rotation.Rotation)1 Transformation (org.spongepowered.api.util.transformation.Transformation)1 Biome (org.spongepowered.api.world.biome.Biome)1 PaletteReference (org.spongepowered.api.world.schematic.PaletteReference)1 PaletteType (org.spongepowered.api.world.schematic.PaletteType)1 StreamOptions (org.spongepowered.api.world.volume.stream.StreamOptions)1 SpongeBuilderProvider (org.spongepowered.common.registry.SpongeBuilderProvider)1 SpongeFactoryProvider (org.spongepowered.common.registry.SpongeFactoryProvider)1 SpongeRegistryKey (org.spongepowered.common.registry.SpongeRegistryKey)1 SpongeRegistryType (org.spongepowered.common.registry.SpongeRegistryType)1 StubGame (org.spongepowered.common.test.stub.StubGame)1 StubKey (org.spongepowered.common.test.stub.StubKey)1 StubBlock (org.spongepowered.common.test.stub.block.StubBlock)1 StubRegistryFactory (org.spongepowered.common.test.stub.registry.StubRegistryFactory)1