mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 19:59:42 +00:00
Forge 1.19
* Bump pack.mcmeta formats * 1.19 biome modifiers * Mark ClientPlayerNetworkEvent.LoggedOutEvent's getters as nullable * Add docs and package-info to client extension interfaces package * Move RenderBlockOverlayEvent hooks to ForgeHooksClient * Add package-infos to client events package * Rename SoundLoadEvent to SoundEngineLoadEvent This reduces confusion from consumers which may think the name SoundLoadEvent refers to an individual sound being loaded rather than the sound engine. * Document and change SoundLoadEvent to fire on mod bus Previously, it fired on both the mod bus and the Forge bus, which is confusing for consumers. * Delete SoundSetupEvent Looking at its original implementation shows that there isn't an appropriate place in the new sound code to reinsert the event, and the place of 'sound engine/manager initialization event' is taken already by SoundLoadEvent. * Perform some cleanup on client events - Removed nullable annotations from ClientPlayerNetworkEvent - Renamed #getPartialTicks methods to #getPartialTick, to be consistent with vanilla's naming of the partial tick - Cleanup documentation to remove line breaks, use the spelling 'cancelled' over 'canceled', and improve docs on existing and new methods. * Remove EntityEvent.CanUpdate Closes MinecraftForge/MinecraftForge#6394 * Switch to Jetbrains nullability annotations * New PlayLevelSoundEvent; replaces old PlaySoundAtEntityEvent * Remove ForgeWorldPresetScreens * Remove IForgeRegistryEntry * Remove use of List<Throwable> in FML's CompletableFutures * Add docs to mod loading stages, stages, and phases * Gradle 7.4.2 * Use SLF4J in FMLLoader and other subprojects * Switch dynamic versions in subprojects to pinned ones * Switch ForgeRoot and MDK to FG plugin markers * Configure Forge javadoc task The task now uses a custom stylesheet with MCForge elements, and configured to combine the generation from the four FML subprojects (fmlloader, fmlcore, javafmllanguage, mclanguage) and the Forge project into the javadoc output. * Update docs/md files, for 1.19 update and the move away from IRC to Discord. * Make "Potentially dangerous alternative prefix" a debug warning, not info. Co-authored-by: Curle <[email protected]> Co-authored-by: sciwhiz12 <[email protected]> Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
1 parent
270e778ac5
commit
4ed9117799
1485 files changed
+14960
-15446
No files matched your search
@@ -37,7 +37,7 @@ public class NewRegistryEvent extends Event implements IModBusEvent
|
||||
* @param builder The builder to turn into a {@link IForgeRegistry}
|
||||
* @return A supplier of the {@link IForgeRegistry} created by the builder. Resolving too early will return null.
|
||||
*/
|
||||
public <V extends IForgeRegistryEntry<V>> Supplier<IForgeRegistry<V>> create(RegistryBuilder<V> builder)
|
||||
public <V> Supplier<IForgeRegistry<V>> create(RegistryBuilder<V> builder)
|
||||
{
|
||||
return create(builder, null);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class NewRegistryEvent extends Event implements IModBusEvent
|
||||
* @param onFill Called when the returned supplier is filled with the registry
|
||||
* @return a supplier of the {@link IForgeRegistry} created by the builder. Resolving too early will return null.
|
||||
*/
|
||||
public <V extends IForgeRegistryEntry<V>> Supplier<IForgeRegistry<V>> create(RegistryBuilder<V> builder, @Nullable Consumer<IForgeRegistry<V>> onFill)
|
||||
public <V> Supplier<IForgeRegistry<V>> create(RegistryBuilder<V> builder, @Nullable Consumer<IForgeRegistry<V>> onFill)
|
||||
{
|
||||
RegistryHolder<V> registryHolder = new RegistryHolder<>();
|
||||
|
||||
@@ -58,75 +58,57 @@ public class NewRegistryEvent extends Event implements IModBusEvent
|
||||
return registryHolder;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
void fill()
|
||||
{
|
||||
RuntimeException aggregate = new RuntimeException();
|
||||
Map<RegistryBuilder<?>, IForgeRegistry<?>> builtRegistries = new IdentityHashMap<>();
|
||||
RuntimeException aggregate = new RuntimeException("Failed to create some forge registries, see suppressed exceptions for details");
|
||||
for (RegistryData<?> registryData : this.registries)
|
||||
{
|
||||
RegistryBuilder<?> builder = registryData.builder();
|
||||
try
|
||||
{
|
||||
builtRegistries.put(builder, builder.create());
|
||||
} catch (Exception e)
|
||||
{
|
||||
aggregate.addSuppressed(e);
|
||||
}
|
||||
}
|
||||
|
||||
builtRegistries.forEach((builder, reg) -> {
|
||||
try
|
||||
{
|
||||
RegistryAccess.RegistryData<?> dataPackRegistryData = builder.getDataPackRegistryData();
|
||||
if (dataPackRegistryData != null) // if this is a datapack registry
|
||||
{
|
||||
if (!BuiltinRegistries.REGISTRY.containsKey(reg.getRegistryName()))
|
||||
{
|
||||
DataPackRegistriesHooks.addRegistryCodec(dataPackRegistryData);
|
||||
RegistryManager.registerToBuiltinRegistry((ForgeRegistry<?>) reg);
|
||||
}
|
||||
}
|
||||
else if (builder.getHasWrapper() && !Registry.REGISTRY.containsKey(reg.getRegistryName()))
|
||||
RegistryManager.registerToRootRegistry((ForgeRegistry<?>) reg);
|
||||
} catch (Exception e)
|
||||
{
|
||||
aggregate.addSuppressed(e);
|
||||
}
|
||||
});
|
||||
|
||||
for (RegistryData data : this.registries)
|
||||
for (RegistryData<?> data : this.registries)
|
||||
{
|
||||
IForgeRegistry<?> registry = builtRegistries.get(data.builder);
|
||||
if (registry != null)
|
||||
try {
|
||||
buildRegistry(builtRegistries, data);
|
||||
} catch (Throwable t)
|
||||
{
|
||||
data.registryHolder.registry = registry;
|
||||
try
|
||||
{
|
||||
if (data.onFill != null)
|
||||
data.onFill.accept(registry);
|
||||
} catch (Exception e)
|
||||
{
|
||||
aggregate.addSuppressed(e);
|
||||
}
|
||||
aggregate.addSuppressed(t);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (aggregate.getSuppressed().length > 0)
|
||||
{
|
||||
// Something had an exception, log and propagate with a throw for when FML eventually logs this too
|
||||
LOGGER.error("", aggregate);
|
||||
throw aggregate;
|
||||
}
|
||||
LOGGER.error(LogUtils.FATAL_MARKER, "Failed to create some forge registries, see suppressed exceptions for details", aggregate);
|
||||
}
|
||||
|
||||
private record RegistryData<V extends IForgeRegistryEntry<V>>(
|
||||
private <T> void buildRegistry(Map<RegistryBuilder<?>, IForgeRegistry<?>> builtRegistries, RegistryData<T> data)
|
||||
{
|
||||
RegistryBuilder<T> builder = data.builder;
|
||||
IForgeRegistry<T> registry = builder.create();
|
||||
|
||||
builtRegistries.put(builder, registry);
|
||||
|
||||
RegistryAccess.RegistryData<?> dataPackRegistryData = builder.getDataPackRegistryData();
|
||||
if (dataPackRegistryData != null) // if this is a datapack registry
|
||||
{
|
||||
if (!BuiltinRegistries.REGISTRY.containsKey(registry.getRegistryName()))
|
||||
{
|
||||
DataPackRegistriesHooks.addRegistryCodec(dataPackRegistryData);
|
||||
RegistryManager.registerToBuiltinRegistry((ForgeRegistry<?>) registry);
|
||||
}
|
||||
}
|
||||
else if (builder.getHasWrapper() && !Registry.REGISTRY.containsKey(registry.getRegistryName()))
|
||||
RegistryManager.registerToRootRegistry((ForgeRegistry<?>) registry);
|
||||
|
||||
data.registryHolder.registry = registry;
|
||||
if (data.onFill != null)
|
||||
data.onFill.accept(registry);
|
||||
}
|
||||
|
||||
private record RegistryData<V>(
|
||||
RegistryBuilder<V> builder,
|
||||
RegistryHolder<V> registryHolder,
|
||||
Consumer<IForgeRegistry<V>> onFill
|
||||
) {}
|
||||
|
||||
private static class RegistryHolder<V extends IForgeRegistryEntry<V>> implements Supplier<IForgeRegistry<V>>
|
||||
private static class RegistryHolder<V> implements Supplier<IForgeRegistry<V>>
|
||||
{
|
||||
IForgeRegistry<V> registry = null;
|
||||
|
||||
|
||||
Reference in new issue
Block a user