use of org.spongepowered.common.test.stub.block.StubBlock 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());
}
Aggregations