mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 06:24:43 +00:00
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:
38 files changed
+803
-814
No files matched your search
@@ -38,14 +38,14 @@ import java.util.function.Supplier;
|
||||
*
|
||||
* This is a parallel dispatch event.
|
||||
*/
|
||||
public class FMLClientSetupEvent extends ModLifecycleEvent
|
||||
public class FMLClientSetupEvent extends ParallelDispatchEvent
|
||||
{
|
||||
private final Supplier<Minecraft> minecraftSupplier;
|
||||
|
||||
public FMLClientSetupEvent(Supplier<Minecraft> mc, ModContainer container)
|
||||
public FMLClientSetupEvent(ModContainer container)
|
||||
{
|
||||
super(container);
|
||||
this.minecraftSupplier = mc;
|
||||
minecraftSupplier = Minecraft::getInstance;
|
||||
}
|
||||
|
||||
public Supplier<Minecraft> getMinecraftSupplier()
|
||||
|
||||
@@ -40,7 +40,7 @@ import java.util.function.Consumer;
|
||||
* @see net.minecraftforge.fml.DeferredWorkQueue to enqueue work to run on the main game thread after this event has
|
||||
* completed dispatch
|
||||
*/
|
||||
public class FMLCommonSetupEvent extends ModLifecycleEvent
|
||||
public class FMLCommonSetupEvent extends ParallelDispatchEvent
|
||||
{
|
||||
public FMLCommonSetupEvent(final ModContainer container)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package net.minecraftforge.fml.event.lifecycle;
|
||||
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
|
||||
public class FMLConstructModEvent extends ParallelDispatchEvent {
|
||||
public FMLConstructModEvent(final ModContainer container) {
|
||||
super(container);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -42,7 +42,7 @@ import java.util.function.Supplier;
|
||||
*
|
||||
* This is a parallel dispatch event.
|
||||
*/
|
||||
public class FMLDedicatedServerSetupEvent extends ModLifecycleEvent
|
||||
public class FMLDedicatedServerSetupEvent extends ParallelDispatchEvent
|
||||
{
|
||||
public FMLDedicatedServerSetupEvent(ModContainer container)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraftforge.fml.ModContainer;
|
||||
*
|
||||
* @author cpw
|
||||
*/
|
||||
public class FMLLoadCompleteEvent extends ModLifecycleEvent
|
||||
public class FMLLoadCompleteEvent extends ParallelDispatchEvent
|
||||
{
|
||||
public FMLLoadCompleteEvent(final ModContainer container)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ package net.minecraftforge.fml.event.lifecycle;
|
||||
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraftforge.client.model.generators.ExistingFileHelper;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
|
||||
import java.nio.file.Path;
|
||||
@@ -33,19 +34,25 @@ import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GatherDataEvent extends ModLifecycleEvent
|
||||
public class GatherDataEvent extends Event implements IModBusEvent
|
||||
{
|
||||
private final DataGenerator dataGenerator;
|
||||
private final DataGeneratorConfig config;
|
||||
private final ExistingFileHelper existingFileHelper;
|
||||
public GatherDataEvent(final ModContainer modContainer, final DataGenerator dataGenerator, final DataGeneratorConfig dataGeneratorConfig, ExistingFileHelper existingFileHelper)
|
||||
private final ModContainer modContainer;
|
||||
|
||||
public GatherDataEvent(final ModContainer mc, final DataGenerator dataGenerator, final DataGeneratorConfig dataGeneratorConfig, ExistingFileHelper existingFileHelper)
|
||||
{
|
||||
super(modContainer);
|
||||
this.modContainer = mc;
|
||||
this.dataGenerator = dataGenerator;
|
||||
this.config = dataGeneratorConfig;
|
||||
this.existingFileHelper = existingFileHelper;
|
||||
}
|
||||
|
||||
public ModContainer getModContainer() {
|
||||
return this.modContainer;
|
||||
}
|
||||
|
||||
public DataGenerator getGenerator() { return this.dataGenerator; }
|
||||
public ExistingFileHelper getExistingFileHelper() { return existingFileHelper; }
|
||||
public boolean includeServer() { return this.config.server; }
|
||||
|
||||
@@ -32,7 +32,7 @@ import net.minecraftforge.fml.ModContainer;
|
||||
*
|
||||
* This is a parallel dispatch event.
|
||||
*/
|
||||
public class InterModEnqueueEvent extends ModLifecycleEvent
|
||||
public class InterModEnqueueEvent extends ParallelDispatchEvent
|
||||
{
|
||||
|
||||
public InterModEnqueueEvent(final ModContainer container)
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.function.Predicate;
|
||||
* @see #getIMCStream()
|
||||
* @see #getIMCStream(Predicate)
|
||||
*/
|
||||
public class InterModProcessEvent extends ModLifecycleEvent
|
||||
public class InterModProcessEvent extends ParallelDispatchEvent
|
||||
{
|
||||
public InterModProcessEvent(final ModContainer container)
|
||||
{
|
||||
|
||||
@@ -54,6 +54,10 @@ public class ModLifecycleEvent extends Event implements IModBusEvent
|
||||
return InterModComms.getMessages(this.container.getModId(), methodFilter);
|
||||
}
|
||||
|
||||
ModContainer getContainer() {
|
||||
return this.container;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return description();
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package net.minecraftforge.fml.event.lifecycle;
|
||||
|
||||
import net.minecraftforge.fml.DeferredWorkQueue;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ParallelDispatchEvent extends ModLifecycleEvent {
|
||||
public ParallelDispatchEvent(final ModContainer container) {
|
||||
super(container);
|
||||
}
|
||||
|
||||
private Optional<DeferredWorkQueue> getQueue() {
|
||||
return DeferredWorkQueue.lookup(Optional.of(getClass()));
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> enqueueWork(Runnable work) {
|
||||
return getQueue().map(q->q.enqueueWork(getContainer().getModInfo(), work)).orElseThrow(()->new RuntimeException("No work queue found!"));
|
||||
}
|
||||
|
||||
public <T> CompletableFuture<T> enqueueWork(Supplier<T> work) {
|
||||
return getQueue().map(q->q.enqueueWork(getContainer().getModInfo(), work)).orElseThrow(()->new RuntimeException("No work queue found!"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user