mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-20 07:24:16 +00:00
Modded registry factories
- Modded platform gets registry access from the modded server factory - Engine bootstrap and tile parity test get tile readers from the modded server factory - Registry access tests build through the modded server factory
This commit is contained in:
+1
-1
@@ -391,7 +391,7 @@ public final class ModdedEngineBootstrap {
|
||||
BlockDataMergeSupport.StateMerger previousMerger = BlockDataMergeSupport.bindPlatformMerger(new NativeStateMerger(ModdedBlockResolution.BLOCKS)::merge);
|
||||
rollback.add(() -> BlockDataMergeSupport.restorePlatformMerger(previousMerger));
|
||||
|
||||
NativeTileReader nativeTileReader = NativeTileReader.forServer(boundLoader::currentServer);
|
||||
NativeTileReader nativeTileReader = NativeModdedServer.tileReader(boundLoader::currentServer);
|
||||
TileData.TileReader previousTileReader = TileData.bindPlatformReader(in -> ModdedTileData.wrap(nativeTileReader.read(in)));
|
||||
rollback.add(() -> TileData.restorePlatformReader(previousTileReader));
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ package art.arcane.iris.modded;
|
||||
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeModdedServer;
|
||||
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeRegistryAccess;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.terrain.NativeRegistryDefinitions;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeEntitySpawns;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeModdedLoader;
|
||||
@@ -61,9 +60,7 @@ public final class ModdedPlatform implements IrisPlatform {
|
||||
public ModdedPlatform(NativeModdedLoader loader) {
|
||||
this.loader = loader;
|
||||
this.registries = new ModdedRegistries(
|
||||
new NativeRegistryAccess(new NativeRegistryAccess.Configuration(
|
||||
ModdedEngineBootstrap::currentServer,
|
||||
ModdedRegistries::warnNotReady)),
|
||||
NativeModdedServer.registryAccess(ModdedEngineBootstrap::currentServer, ModdedRegistries::warnNotReady),
|
||||
ModdedPlatform::generationRegistry);
|
||||
this.scheduler = new ModdedScheduler();
|
||||
this.structureHooks = new ModdedStructureHooks(ModdedEngineBootstrap::currentServer);
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package art.arcane.iris.modded;
|
||||
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeModdedServer;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeTileReader;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.ModdedBlockState;
|
||||
import art.arcane.iris.generation.block.TileData;
|
||||
@@ -41,7 +42,7 @@ public class ModdedTileParityTest {
|
||||
SharedConstants.tryDetectVersion();
|
||||
Bootstrap.bootStrap();
|
||||
registries = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY);
|
||||
NativeTileReader nativeTileReader = NativeTileReader.forServer(() -> null);
|
||||
NativeTileReader nativeTileReader = NativeModdedServer.tileReader(() -> null);
|
||||
TileData.bindPlatformReader(in -> ModdedTileData.wrap(nativeTileReader.read(in)));
|
||||
TileData.bindPlatformFactory(ModdedTileData::fromProperties);
|
||||
}
|
||||
|
||||
+3
-3
@@ -36,7 +36,7 @@ public class NativeRegistryAccessTest {
|
||||
|
||||
@Test
|
||||
public void statePropertiesPreserveTypesDefaultsAndSharedGroups() {
|
||||
NativeRegistryAccess access = new NativeRegistryAccess(new NativeRegistryAccess.Configuration(() -> null, message -> {}));
|
||||
NativeRegistryAccess access = NativeModdedServer.registryAccess(() -> null, message -> {});
|
||||
Map<String, List<NativeBlockProperty>> properties = access.blockStateProperties();
|
||||
|
||||
assertSame(properties.get("minecraft:stone"), properties.get("minecraft:dirt"));
|
||||
@@ -52,7 +52,7 @@ public class NativeRegistryAccessTest {
|
||||
@Test
|
||||
public void staticRegistriesResolveWithoutAnActiveServerAndDynamicReadsStayEmpty() {
|
||||
List<String> warnings = new ArrayList<>();
|
||||
NativeRegistryAccess access = new NativeRegistryAccess(new NativeRegistryAccess.Configuration(() -> null, warnings::add));
|
||||
NativeRegistryAccess access = NativeModdedServer.registryAccess(() -> null, warnings::add);
|
||||
|
||||
assertEquals("minecraft:diamond_sword", access.item("DIAMOND SWORD").key());
|
||||
assertEquals("creature", access.entity("minecraft:cow").spawnCategory());
|
||||
@@ -68,7 +68,7 @@ public class NativeRegistryAccessTest {
|
||||
public void dynamicRegistriesFollowServerStartupReloadAndShutdown() {
|
||||
AtomicReference<NativeModdedServer> activeServer = new AtomicReference<>();
|
||||
List<String> warnings = new ArrayList<>();
|
||||
NativeRegistryAccess access = new NativeRegistryAccess(new NativeRegistryAccess.Configuration(activeServer::get, warnings::add));
|
||||
NativeRegistryAccess access = NativeModdedServer.registryAccess(activeServer::get, warnings::add);
|
||||
assertTrue(access.lootTableKeys().isEmpty());
|
||||
|
||||
MinecraftServer server = mock(MinecraftServer.class, RETURNS_DEEP_STUBS);
|
||||
|
||||
Reference in New Issue
Block a user