Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package dev.architectury.registry.registries;

import com.mojang.serialization.Codec;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
Expand Down Expand Up @@ -77,6 +78,10 @@ default Holder<T> getHolder(ResourceLocation id) {
return getHolder(ResourceKey.create(key(), id));
}

Codec<T> codec();

Codec<Holder<T>> holderCodec();

/**
* Listens to when the registry entry is registered, and calls the given action.
* Evaluates immediately if the entry is already registered.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.common.base.Suppliers;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.mojang.serialization.Codec;
import dev.architectury.impl.RegistrySupplierImpl;
import dev.architectury.registry.registries.Registrar;
import dev.architectury.registry.registries.RegistrarBuilder;
Expand Down Expand Up @@ -289,6 +290,16 @@ public Holder<T> getHolder(ResourceKey<T> key) {
return delegate.getHolder(key).orElse(null);
}

@Override
public Codec<T> codec() {
return delegate.byNameCodec();
}

@Override
public Codec<Holder<T>> holderCodec() {
return delegate.holderByNameCodec();
}

@Override
public Iterator<T> iterator() {
return delegate.iterator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.common.base.Suppliers;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.mojang.serialization.Codec;
import dev.architectury.impl.RegistrySupplierImpl;
import dev.architectury.platform.hooks.EventBusesHooks;
import dev.architectury.registry.registries.Registrar;
Expand Down Expand Up @@ -397,6 +398,16 @@ public Holder<T> getHolder(ResourceKey<T> key) {
return delegate.getHolder(key).orElse(null);
}

@Override
public Codec<T> codec() {
return delegate.byNameCodec();
}

@Override
public Codec<Holder<T>> holderCodec() {
return delegate.holderByNameCodec();
}

@Override
public Iterator<T> iterator() {
return delegate.iterator();
Expand Down