Merge branch '1.16.1' into 1.16.x

# Conflicts:
#	patches/minecraft/net/minecraft/client/Minecraft.java.patch
#	patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch
#	src/main/java/net/minecraftforge/fml/client/ClientModLoader.java
#	src/main/java/net/minecraftforge/registries/GameData.java
This commit is contained in:
cpw committed 2020-08-31 21:15:56 -04:00
commit bfeec0c7bd
38 files changed
+803 -814

No files matched your search

@@ -20,13 +20,18 @@
package net.minecraftforge.event;
import com.google.common.collect.ImmutableList;
import net.minecraft.profiler.IProfiler;
import net.minecraft.resources.DataPackRegistries;
import net.minecraft.resources.IFutureReloadListener;
import net.minecraft.resources.IResourceManager;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.ModLoader;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
/**
* The main ResourceManager is recreated on each reload, through {@link DataPackRegistries}'s creation.
@@ -49,7 +54,7 @@ public class AddReloadListenerEvent extends Event
*/
public void addListener(IFutureReloadListener listener)
{
listeners.add(listener);
listeners.add(new WrappedStateAwareListener(listener));
}
public List<IFutureReloadListener> getListeners()
@@ -61,4 +66,19 @@ public class AddReloadListenerEvent extends Event
{
return dataPackRegistries;
}
private static class WrappedStateAwareListener implements IFutureReloadListener {
private final IFutureReloadListener wrapped;
private WrappedStateAwareListener(final IFutureReloadListener wrapped) {
this.wrapped = wrapped;
}
@Override
public CompletableFuture<Void> reload(final IStage stage, final IResourceManager resourceManager, final IProfiler preparationsProfiler, final IProfiler reloadProfiler, final Executor backgroundExecutor, final Executor gameExecutor) {
if (ModLoader.isLoadingStateValid())
return wrapped.reload(stage, resourceManager, preparationsProfiler, reloadProfiler, backgroundExecutor, gameExecutor);
else
return CompletableFuture.completedFuture(null);
}
}
}
@@ -46,6 +46,7 @@ public class RegistryEvent<T extends IForgeRegistryEntry<T>> extends GenericEven
*/
public static class NewRegistry extends net.minecraftforge.eventbus.api.Event implements IModBusEvent
{
public NewRegistry(ModContainer mc) {}
@Override
public String toString() {
return "RegistryEvent.NewRegistry";