package moe.nea.firmament.util.mc import com.mojang.serialization.DynamicOps import java.util.Optional import net.minecraft.registry.Registry import net.minecraft.registry.RegistryKey import net.minecraft.registry.RegistryOps import net.minecraft.registry.RegistryWrapper import net.minecraft.registry.entry.RegistryEntryOwner class TolerantRegistriesOps( delegate: DynamicOps, registryInfoGetter: RegistryInfoGetter ) : RegistryOps(delegate, registryInfoGetter) { constructor(delegate: DynamicOps, registry: RegistryWrapper.WrapperLookup) : this(delegate, CachedRegistryInfoGetter(registry)) class TolerantOwner : RegistryEntryOwner { override fun ownerEquals(other: RegistryEntryOwner?): Boolean { return true } } override fun getOwner(registryRef: RegistryKey>?): Optional> { return super.getOwner(registryRef).map { TolerantOwner() } } }