mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-16 10:34:49 +00:00
Re-introduce patch for injecting registry mappings during world loading.
And re-introduce registry freezing to ONLY the Register events. Filter ObjectHolders by registry type and fire between every Register event.
This commit is contained in:
1 parent
cd21f7b927
commit
3b029ba031
10 files changed
+93
-44
No files matched your search
@@ -24,6 +24,8 @@ import java.lang.reflect.Modifier;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.ResourceLocationException;
|
||||
@@ -34,7 +36,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class ObjectHolderRef implements Runnable
|
||||
public class ObjectHolderRef implements Consumer<Predicate<ResourceLocation>>
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private Field field;
|
||||
@@ -132,8 +134,11 @@ public class ObjectHolderRef implements Runnable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
public void accept(Predicate<ResourceLocation> filter)
|
||||
{
|
||||
if (registry == null || !filter.test(registry.getRegistryName()))
|
||||
return;
|
||||
|
||||
Object thing;
|
||||
if (isValid && registry.containsKey(injectedObject) && !registry.isDummied(injectedObject))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user