mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 11:05:40 +00:00
Add support for server side only recipes, as well as detection of vanilla client recipe book filter to prevent errors.
This commit is contained in:
1 parent
ee27276ba2
commit
28e341002f
14 files changed
+168
-55
No files matched your search
@@ -33,6 +33,7 @@ import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Queues;
|
||||
@@ -68,10 +69,13 @@ import net.minecraft.item.ItemBucket;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.SPacketBlockChange;
|
||||
import net.minecraft.network.play.server.SPacketRecipeBook;
|
||||
import net.minecraft.network.play.server.SPacketRecipeBook.State;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityNote;
|
||||
@@ -131,7 +135,12 @@ import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.LoaderState;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;
|
||||
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.ConnectionType;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.RegistryManager;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -1337,4 +1346,22 @@ public class ForgeHooks
|
||||
true, true
|
||||
);
|
||||
}
|
||||
|
||||
public static void sendRecipeBook(NetHandlerPlayServer connection, State state, List<IRecipe> recipes, List<IRecipe> display, boolean isGuiOpen, boolean isFilteringCraftable)
|
||||
{
|
||||
NetworkDispatcher disp = NetworkDispatcher.get(connection.getNetworkManager());
|
||||
//Not sure how it could ever be null, but screw it lets protect against it. Could Error the client but we dont care if they are asking for this stuff in the wrong state!
|
||||
ConnectionType type = disp == null || disp.getConnectionType() == null ? ConnectionType.MODDED : disp.getConnectionType();
|
||||
if (type == ConnectionType.VANILLA)
|
||||
{
|
||||
IForgeRegistry<IRecipe> vanilla = RegistryManager.VANILLA.getRegistry(IRecipe.class);
|
||||
if (recipes.size() > 0)
|
||||
recipes = recipes.stream().filter(e -> vanilla.containsValue(e)).collect(Collectors.toList());
|
||||
if (display.size() > 0)
|
||||
display = display.stream().filter(e -> vanilla.containsValue(e)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if (recipes.size() > 0 || display.size() > 0)
|
||||
connection.sendPacket(new SPacketRecipeBook(state, recipes, display, isGuiOpen, isFilteringCraftable));
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class AutomaticEventSubscriber
|
||||
FMLLog.log.debug("Injected @EventBusSubscriber class {}", targ.getClassName());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Throwable e)
|
||||
{
|
||||
FMLLog.log.error("An error occurred trying to load an EventBusSubscriber {} for modid {}", mod.getModId(), e);
|
||||
throw new LoaderException(e);
|
||||
|
||||
+2
-2
@@ -145,8 +145,8 @@ enum FMLHandshakeClientState implements IHandshakeState<FMLHandshakeClientState>
|
||||
if (!locallyMissing.isEmpty())
|
||||
{
|
||||
NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
|
||||
dispatcher.rejectHandshake("Fatally missing blocks and items");
|
||||
FMLLog.log.fatal("Failed to connect to server: there are {} missing blocks and items", locallyMissing.size());
|
||||
dispatcher.rejectHandshake("Fatally missing registry entries");
|
||||
FMLLog.log.fatal("Failed to connect to server: there are {} missing registry items", locallyMissing.size());
|
||||
locallyMissing.asMap().forEach((key, value) -> FMLLog.log.debug("Missing {} Entries: {}", key, value));
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
+6
-3
@@ -68,8 +68,6 @@ import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.registries.ForgeRegistry;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
// TODO build test suites to validate the behaviour of this stuff and make it less annoyingly magical
|
||||
public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> implements ChannelOutboundHandler {
|
||||
private static boolean DEBUG_HANDSHAKE = Boolean.parseBoolean(System.getProperty("fml.debugNetworkHandshake", "false"));
|
||||
@@ -77,7 +75,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
|
||||
OPENING, AWAITING_HANDSHAKE, HANDSHAKING, HANDSHAKECOMPLETE, FINALIZING, CONNECTED
|
||||
}
|
||||
|
||||
private static enum ConnectionType {
|
||||
public static enum ConnectionType {
|
||||
MODDED, BUKKIT, VANILLA
|
||||
}
|
||||
|
||||
@@ -667,4 +665,9 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
|
||||
return this.data_buf;
|
||||
}
|
||||
}
|
||||
|
||||
public ConnectionType getConnectionType()
|
||||
{
|
||||
return this.connectionType;
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,7 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
private final CreateCallback<V> create;
|
||||
private final AddCallback<V> add;
|
||||
private final ClearCallback<V> clear;
|
||||
private final MissingFactory<V> missing;
|
||||
private final BitSet availabilityMap;
|
||||
private final Set<ResourceLocation> dummies = Sets.newHashSet();
|
||||
private final Set<Integer> blocked = Sets.newHashSet();
|
||||
@@ -80,7 +81,7 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
private V defaultValue = null;
|
||||
boolean isFrozen = false;
|
||||
|
||||
ForgeRegistry(Class<V> superType, ResourceLocation defaultKey, int min, int max, @Nullable CreateCallback<V> create, @Nullable AddCallback<V> add, @Nullable ClearCallback<V> clear, RegistryManager stage, boolean allowOverrides, boolean isModifiable, @Nullable DummyFactory<V> dummyFactory)
|
||||
ForgeRegistry(Class<V> superType, ResourceLocation defaultKey, int min, int max, @Nullable CreateCallback<V> create, @Nullable AddCallback<V> add, @Nullable ClearCallback<V> clear, RegistryManager stage, boolean allowOverrides, boolean isModifiable, @Nullable DummyFactory<V> dummyFactory, @Nullable MissingFactory<V> missing)
|
||||
{
|
||||
this.stage = stage;
|
||||
this.superType = superType;
|
||||
@@ -91,6 +92,7 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
this.create = create;
|
||||
this.add = add;
|
||||
this.clear = clear;
|
||||
this.missing = missing;
|
||||
this.isDelegated = IForgeRegistryEntry.Impl.class.isAssignableFrom(superType); //TODO: Make this IDelegatedRegistryEntry?
|
||||
this.allowOverrides = allowOverrides;
|
||||
this.isModifiable = isModifiable;
|
||||
@@ -251,7 +253,7 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
|
||||
ForgeRegistry<V> copy(RegistryManager stage)
|
||||
{
|
||||
return new ForgeRegistry<V>(superType, defaultKey, min, max, create, add, clear, stage, allowOverrides, isModifiable, dummyFactory);
|
||||
return new ForgeRegistry<V>(superType, defaultKey, min, max, create, add, clear, stage, allowOverrides, isModifiable, dummyFactory, missing);
|
||||
}
|
||||
|
||||
int add(int id, V value)
|
||||
@@ -756,7 +758,7 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
return new MissingMappings<V>(name, this, lst);
|
||||
}
|
||||
|
||||
void processMissingEvent(ResourceLocation name, ForgeRegistry<V> pool, List<MissingMappings.Mapping<V>> mappings, Map<ResourceLocation, Integer> missing, Map<ResourceLocation, Integer[]> remaps, Collection<ResourceLocation> defaulted, Collection<ResourceLocation> failed)
|
||||
void processMissingEvent(ResourceLocation name, ForgeRegistry<V> pool, List<MissingMappings.Mapping<V>> mappings, Map<ResourceLocation, Integer> missing, Map<ResourceLocation, Integer[]> remaps, Collection<ResourceLocation> defaulted, Collection<ResourceLocation> failed, boolean injectNetworkDummies)
|
||||
{
|
||||
FMLLog.log.debug("Processing missing event for {}:", name);
|
||||
int ignored = 0;
|
||||
@@ -791,7 +793,11 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
// block item missing, warn as requested and block the id
|
||||
if (action == MissingMappings.Action.DEFAULT)
|
||||
{
|
||||
defaulted.add(remap.key);
|
||||
V m = this.missing == null ? null : this.missing.createMissing(remap.key, injectNetworkDummies);
|
||||
if (m == null)
|
||||
defaulted.add(remap.key);
|
||||
else
|
||||
this.add(remap.id, m, remap.key.getResourceDomain());
|
||||
}
|
||||
else if (action == MissingMappings.Action.IGNORE)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,11 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionType;
|
||||
@@ -40,6 +43,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.registry.RegistryNamespaced;
|
||||
import net.minecraft.util.registry.RegistryNamespacedDefaultedByKey;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
@@ -128,7 +132,7 @@ public class GameData
|
||||
makeRegistry(SOUNDEVENTS, SoundEvent.class, MAX_SOUND_ID).create();
|
||||
makeRegistry(POTIONTYPES, PotionType.class, MAX_POTIONTYPE_ID, new ResourceLocation("empty")).create();
|
||||
makeRegistry(ENCHANTMENTS, Enchantment.class, MAX_ENCHANTMENT_ID).create();
|
||||
makeRegistry(RECIPES, IRecipe.class, MAX_RECIPE_ID).disableSaving().allowModification().create();
|
||||
makeRegistry(RECIPES, IRecipe.class, MAX_RECIPE_ID).disableSaving().allowModification().addCallback(RecipeCallbacks.INSTANCE).create();
|
||||
makeRegistry(PROFESSIONS, VillagerProfession.class, MAX_PROFESSION_ID).create();
|
||||
entityRegistry = (ForgeRegistry<EntityEntry>)makeRegistry(ENTITIES, EntityEntry.class, MAX_ENTITY_ID).addCallback(EntityCallbacks.INSTANCE).create();
|
||||
}
|
||||
@@ -276,7 +280,6 @@ public class GameData
|
||||
private static class BlockCallbacks implements IForgeRegistry.AddCallback<Block>, IForgeRegistry.ClearCallback<Block>, IForgeRegistry.CreateCallback<Block>, IForgeRegistry.DummyFactory<Block>
|
||||
{
|
||||
static final BlockCallbacks INSTANCE = new BlockCallbacks();
|
||||
Field regName;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
@@ -349,31 +352,8 @@ public class GameData
|
||||
@Override
|
||||
public Block createDummy(ResourceLocation key)
|
||||
{
|
||||
if (regName == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
regName = IForgeRegistryEntry.Impl.class.getDeclaredField("registryName");
|
||||
regName.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException | SecurityException e)
|
||||
{
|
||||
FMLLog.log.error("Could not get `registryName` field from IForgeRegistryEntry.Impl");
|
||||
FMLLog.log.throwing(Level.ERROR, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
Block ret = new BlockDummyAir().setUnlocalizedName("air");
|
||||
try
|
||||
{
|
||||
regName.set(ret, key);
|
||||
}
|
||||
catch (IllegalArgumentException | IllegalAccessException e)
|
||||
{
|
||||
FMLLog.log.error("Could not set `registryName` field in IForgeRegistryEntry.Impl to `{}`", key.toString());
|
||||
FMLLog.log.throwing(Level.ERROR, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
GameData.forceRegistryName(ret, key);
|
||||
return ret;
|
||||
}
|
||||
private static class BlockDummyAir extends BlockAir //A named class so DummyBlockReplacementTest can detect if its a dummy
|
||||
@@ -414,6 +394,35 @@ public class GameData
|
||||
}
|
||||
}
|
||||
|
||||
private static class RecipeCallbacks implements IForgeRegistry.MissingFactory<IRecipe>
|
||||
{
|
||||
static final RecipeCallbacks INSTANCE = new RecipeCallbacks();
|
||||
|
||||
@Override
|
||||
public IRecipe createMissing(ResourceLocation key, boolean isNetwork)
|
||||
{
|
||||
return isNetwork ? new DummyRecipe().setRegistryName(key) : null;
|
||||
}
|
||||
private static class DummyRecipe implements IRecipe
|
||||
{
|
||||
private static ItemStack result = new ItemStack(Items.DIAMOND, 64);
|
||||
private ResourceLocation name;
|
||||
|
||||
@Override
|
||||
public IRecipe setRegistryName(ResourceLocation name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
@Override public ResourceLocation getRegistryName() { return name; }
|
||||
@Override public Class<IRecipe> getRegistryType() { return IRecipe.class; }
|
||||
@Override public boolean matches(InventoryCrafting inv, World worldIn) { return false; } //dirt?
|
||||
@Override public ItemStack getCraftingResult(InventoryCrafting inv) { return result; }
|
||||
@Override public boolean canFit(int width, int height) { return false; }
|
||||
@Override public ItemStack getRecipeOutput() { return result; }
|
||||
@Override public boolean isHidden() { return true; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static ForgeRegistry<EntityEntry> entityRegistry;
|
||||
public static ForgeRegistry<EntityEntry> getEntityRegistry() { return entityRegistry; }
|
||||
@@ -559,16 +568,12 @@ public class GameData
|
||||
if (!lst.isEmpty())
|
||||
{
|
||||
FMLLog.log.error("Unidentified mapping from registry {}", name);
|
||||
lst.forEach(map -> {
|
||||
FMLLog.log.error(" {}: {}", map.key, map.id);
|
||||
if (!isLocalWorld)
|
||||
defaulted.put(name, map.key);
|
||||
});
|
||||
lst.forEach(map -> FMLLog.log.error(" {}: {}", map.key, map.id));
|
||||
}
|
||||
event.getAllMappings().stream().filter(e -> e.getAction() == MissingMappings.Action.FAIL).forEach(fail -> failed.put(name, fail.key));
|
||||
|
||||
final Class<? extends IForgeRegistryEntry> clazz = RegistryManager.ACTIVE.getSuperType(name);
|
||||
processMissing(clazz, name, STAGING, event, m.getValue(), remaps.get(name), defaulted.get(name), failed.get(name));
|
||||
processMissing(clazz, name, STAGING, event, m.getValue(), remaps.get(name), defaulted.get(name), failed.get(name), !isLocalWorld);
|
||||
});
|
||||
|
||||
if (!defaulted.isEmpty() && !isLocalWorld)
|
||||
@@ -679,12 +684,12 @@ public class GameData
|
||||
|
||||
//Another bouncer for generic reasons
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T extends IForgeRegistryEntry<T>> void processMissing(Class<T> clazz, ResourceLocation name, RegistryManager STAGING, MissingMappings<?> e, Map<ResourceLocation, Integer> missing, Map<ResourceLocation, Integer[]> remaps, Collection<ResourceLocation> defaulted, Collection<ResourceLocation> failed)
|
||||
private static <T extends IForgeRegistryEntry<T>> void processMissing(Class<T> clazz, ResourceLocation name, RegistryManager STAGING, MissingMappings<?> e, Map<ResourceLocation, Integer> missing, Map<ResourceLocation, Integer[]> remaps, Collection<ResourceLocation> defaulted, Collection<ResourceLocation> failed, boolean injectNetworkDummies)
|
||||
{
|
||||
List<MissingMappings.Mapping<T>> mappings = ((MissingMappings<T>)e).getAllMappings();
|
||||
ForgeRegistry<T> active = RegistryManager.ACTIVE.getRegistry(name);
|
||||
ForgeRegistry<T> staging = STAGING.getRegistry(name);
|
||||
staging.processMissingEvent(name, active, mappings, missing, remaps, defaulted, failed);
|
||||
staging.processMissingEvent(name, active, mappings, missing, remaps, defaulted, failed, injectNetworkDummies);
|
||||
}
|
||||
|
||||
private static <T extends IForgeRegistryEntry<T>> void loadFrozenDataToStagingRegistry(RegistryManager STAGING, ResourceLocation name, Map<ResourceLocation, Integer[]> remaps, Class<T> clazz)
|
||||
@@ -742,4 +747,34 @@ public class GameData
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
private static Field regName;
|
||||
private static void forceRegistryName(IForgeRegistryEntry<?> entry, ResourceLocation name)
|
||||
{
|
||||
if (regName == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
regName = IForgeRegistryEntry.Impl.class.getDeclaredField("registryName");
|
||||
regName.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException | SecurityException e)
|
||||
{
|
||||
FMLLog.log.error("Could not get `registryName` field from IForgeRegistryEntry.Impl");
|
||||
FMLLog.log.throwing(Level.ERROR, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
regName.set(entry, name);
|
||||
}
|
||||
catch (IllegalArgumentException | IllegalAccessException e)
|
||||
{
|
||||
FMLLog.log.error("Could not set `registryName` field in IForgeRegistryEntry.Impl to `{}`", name.toString());
|
||||
FMLLog.log.throwing(Level.ERROR, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -94,4 +94,12 @@ public interface IForgeRegistry<V extends IForgeRegistryEntry<V>> extends Iterab
|
||||
{
|
||||
V createDummy(ResourceLocation key);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
interface MissingFactory<V extends IForgeRegistryEntry<V>>
|
||||
{
|
||||
V createMissing(ResourceLocation key, boolean isNetwork);
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ public class RegistryBuilder<T extends IForgeRegistryEntry<T>>
|
||||
private boolean allowOverrides = true;
|
||||
private boolean allowModifications = false;
|
||||
private DummyFactory<T> dummyFactory;
|
||||
private MissingFactory<T> missingFactory;
|
||||
|
||||
public RegistryBuilder<T> setName(ResourceLocation name)
|
||||
{
|
||||
@@ -84,6 +85,8 @@ public class RegistryBuilder<T extends IForgeRegistryEntry<T>>
|
||||
this.add((CreateCallback<T>)inst);
|
||||
if (inst instanceof DummyFactory)
|
||||
this.set((DummyFactory<T>)inst);
|
||||
if (inst instanceof MissingFactory)
|
||||
this.set((MissingFactory<T>)inst);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -111,6 +114,12 @@ public class RegistryBuilder<T extends IForgeRegistryEntry<T>>
|
||||
return this;
|
||||
}
|
||||
|
||||
public RegistryBuilder<T> set(MissingFactory<T> missing)
|
||||
{
|
||||
this.missingFactory = missing;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RegistryBuilder<T> disableSaving()
|
||||
{
|
||||
this.saveToDisc = false;
|
||||
@@ -132,7 +141,7 @@ public class RegistryBuilder<T extends IForgeRegistryEntry<T>>
|
||||
public IForgeRegistry<T> create()
|
||||
{
|
||||
return RegistryManager.ACTIVE.createRegistry(registryName, registryType, optionalDefaultKey, minId, maxId,
|
||||
getAdd(), getClear(), getCreate(), saveToDisc, allowOverrides, allowModifications, dummyFactory);
|
||||
getAdd(), getClear(), getCreate(), saveToDisc, allowOverrides, allowModifications, dummyFactory, missingFactory);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -76,7 +76,7 @@ public class RegistryManager
|
||||
|
||||
<V extends IForgeRegistryEntry<V>> ForgeRegistry<V> createRegistry(ResourceLocation name, Class<V> type, ResourceLocation defaultKey, int min, int max,
|
||||
@Nullable AddCallback<V> add, @Nullable ClearCallback<V> clear, @Nullable CreateCallback<V> create,
|
||||
boolean persisted, boolean allowOverrides, boolean isModifiable, @Nullable DummyFactory<V> dummyFactory)
|
||||
boolean persisted, boolean allowOverrides, boolean isModifiable, @Nullable DummyFactory<V> dummyFactory, @Nullable MissingFactory<V> missing)
|
||||
{
|
||||
Set<Class<?>> parents = Sets.newHashSet();
|
||||
findSuperTypes(type, parents);
|
||||
@@ -87,7 +87,7 @@ public class RegistryManager
|
||||
FMLLog.log.error("Found existing registry of type {} named {}, you cannot create a new registry ({}) with type {}, as {} has a parent of that type", foundType, superTypes.get(foundType), name, type, type);
|
||||
throw new IllegalArgumentException("Duplicate registry parent type found - you can only have one registry for a particular super type");
|
||||
}
|
||||
ForgeRegistry<V> reg = new ForgeRegistry<V>(type, defaultKey, min, max, create, add, clear, this, allowOverrides, isModifiable, dummyFactory);
|
||||
ForgeRegistry<V> reg = new ForgeRegistry<V>(type, defaultKey, min, max, create, add, clear, this, allowOverrides, isModifiable, dummyFactory, missing);
|
||||
registries.put(name, reg);
|
||||
superTypes.put(type, name);
|
||||
if (persisted)
|
||||
|
||||
Reference in new issue
Block a user