mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 19:39:22 +00:00
Forge 1.19.3
Created a CreativeModeTabEvent to register creative mode tabs and populate entries per tab Moved datapack registries to DataPackRegistryEvent.NewRegistry event instead of tying them to ForgeRegistry Made it easier for mods to datagen datapack builtin entries with DatapackBuiltinEntriesProvider Provided access to lookupProvider for datagen Updated dependencies to match versions used by vanilla and update JarJar to 0.3.18 Added a test mod for the new CreativeModeTabEvent Throws better error message for Forge registries in tag datagen Deleted ForgeRegistryTagsProvider Updated ClientChatReceivedEvent and ServerChatEvent for Mojang changes Added patches for both sign related methods in ModelLayers Changed RegisterShadersEvent to use ResourceProvider Migrated old Mojang math types to JOML Co-authored-by: Marc Hermans <[email protected]> Co-authored-by: LexManos <[email protected]> Co-authored-by: sciwhiz12 <[email protected]> Co-authored-by: coehlrich <[email protected]>
This commit is contained in:
1 parent
617ecb7ad3
commit
8255d7aed3
726 files changed
+7615
-6653
No files matched your search
@@ -5,51 +5,47 @@
|
||||
|
||||
package net.minecraftforge.registries;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.resources.RegistryDataLoader;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public final class DataPackRegistriesHooks
|
||||
{
|
||||
private DataPackRegistriesHooks() {} // utility class
|
||||
|
||||
private static Map<ResourceKey<? extends Registry<?>>, RegistryAccess.RegistryData<?>> REGISTRY_ACCESS_REGISTRIES_COPY;
|
||||
private static final Set<ResourceKey<? extends Registry<?>>> SYNCED_CUSTOM_REGISTRIES = new HashSet<>();
|
||||
private static final Set<ResourceKey<? extends Registry<?>>> SYNCED_CUSTOM_REGISTRIES_VIEW = Collections.unmodifiableSet(SYNCED_CUSTOM_REGISTRIES);
|
||||
|
||||
/* Internal forge hook for retaining mutable access to RegistryAccess's codec registry when it bootstraps. */
|
||||
public static Map<ResourceKey<? extends Registry<?>>, RegistryAccess.RegistryData<?>> grabBuiltinRegistries(ImmutableMap.Builder<ResourceKey<? extends Registry<?>>, RegistryAccess.RegistryData<?>> builder)
|
||||
{
|
||||
REGISTRY_ACCESS_REGISTRIES_COPY = new HashMap<>(builder.build());
|
||||
SYNCED_CUSTOM_REGISTRIES.clear();
|
||||
return Collections.unmodifiableMap(REGISTRY_ACCESS_REGISTRIES_COPY);
|
||||
}
|
||||
private static final List<RegistryDataLoader.RegistryData<?>> DATA_PACK_REGISTRIES = new ArrayList<>(RegistryDataLoader.WORLDGEN_REGISTRIES);
|
||||
private static final List<RegistryDataLoader.RegistryData<?>> DATA_PACK_REGISTRIES_VIEW = Collections.unmodifiableList(DATA_PACK_REGISTRIES);
|
||||
private static final Set<ResourceKey<? extends Registry<?>>> SYNCED_CUSTOM_REGISTRIES = new HashSet<>();
|
||||
private static final Set<ResourceKey<? extends Registry<?>>> SYNCED_CUSTOM_REGISTRIES_VIEW = Collections.unmodifiableSet(SYNCED_CUSTOM_REGISTRIES);
|
||||
|
||||
/* Internal forge method, registers a datapack registry codec and folder. */
|
||||
public static <T> void addRegistryCodec(@NotNull RegistryAccess.RegistryData<T> data)
|
||||
static <T> void addRegistryCodec(DataPackRegistryEvent.DataPackRegistryData<T> data)
|
||||
{
|
||||
ResourceKey<? extends Registry<T>> registryKey = data.key();
|
||||
REGISTRY_ACCESS_REGISTRIES_COPY.put(registryKey, data);
|
||||
RegistryDataLoader.RegistryData<T> loaderData = data.loaderData();
|
||||
DATA_PACK_REGISTRIES.add(loaderData);
|
||||
if (data.networkCodec() != null)
|
||||
{
|
||||
SYNCED_CUSTOM_REGISTRIES.add(registryKey);
|
||||
}
|
||||
SYNCED_CUSTOM_REGISTRIES.add(loaderData.key());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@return unmodifiable view of the set of synced non-vanilla datapack registry IDs}
|
||||
* {@return An unmodifiable view of the list of datapack registries}.
|
||||
* These registries are loaded from per-world datapacks on server startup.
|
||||
*/
|
||||
public static List<RegistryDataLoader.RegistryData<?>> getDataPackRegistries()
|
||||
{
|
||||
return DATA_PACK_REGISTRIES_VIEW;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return An unmodifiable view of the set of synced non-vanilla datapack registry IDs}
|
||||
* Clients must have each of a server's synced datapack registries to be able to connect to that server;
|
||||
* vanilla clients therefore cannot connect if this list is non-empty on the server.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user