diff --git a/src/main/java/org/spongepowered/common/SpongeCommon.java b/src/main/java/org/spongepowered/common/SpongeCommon.java index 51ce152496a..2789b1c36bc 100644 --- a/src/main/java/org/spongepowered/common/SpongeCommon.java +++ b/src/main/java/org/spongepowered/common/SpongeCommon.java @@ -28,6 +28,7 @@ import com.google.inject.Singleton; import net.minecraft.SharedConstants; import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; import org.apache.logging.log4j.LogManager; @@ -95,8 +96,12 @@ public static MinecraftServer server() { return (MinecraftServer) Sponge.server(); } + public static RegistryAccess.Frozen vanillaRegistryAccess() { + return SpongeCommon.server().registryAccess(); + } + public static Registry vanillaRegistry(ResourceKey> key) { - return SpongeCommon.server().registryAccess().registryOrThrow(key); + return SpongeCommon.vanillaRegistryAccess().registryOrThrow(key); } public static ServerScheduler serverScheduler() { diff --git a/src/main/java/org/spongepowered/common/block/entity/SpongeBlockEntityArchetype.java b/src/main/java/org/spongepowered/common/block/entity/SpongeBlockEntityArchetype.java index 4c65288795c..f4331bc2054 100644 --- a/src/main/java/org/spongepowered/common/block/entity/SpongeBlockEntityArchetype.java +++ b/src/main/java/org/spongepowered/common/block/entity/SpongeBlockEntityArchetype.java @@ -198,8 +198,7 @@ public String toString() { if (this.cachedBlockEntity == null) { final CompoundTag compound = this.compound.copy(); compound.putString(Constants.Item.BLOCK_ENTITY_ID, SpongeCommon.vanillaRegistry(Registries.BLOCK_ENTITY_TYPE).getKey((net.minecraft.world.level.block.entity.BlockEntityType) this.type).toString()); - //TODO fixme - //this.cachedBlockEntity = net.minecraft.world.level.block.entity.BlockEntity.loadStatic(new BlockPos(0, 0, 0), (net.minecraft.world.level.block.state.BlockState) this.blockState, compound); + this.cachedBlockEntity = net.minecraft.world.level.block.entity.BlockEntity.loadStatic(new BlockPos(0, 0, 0), (net.minecraft.world.level.block.state.BlockState) this.blockState, compound, SpongeCommon.vanillaRegistryAccess()); } return Arrays.asList(this, (DataHolder) this.cachedBlockEntity); }