Fix MissingMapping REMAP action. Closes #4069
This commit is contained in:
parent
7281708df6
commit
d0b24313d3
2 changed files with 6 additions and 3 deletions
|
@ -159,14 +159,16 @@ public class RegistryEvent<T extends IForgeRegistryEntry<T>> extends GenericEven
|
|||
public static class Mapping<T extends IForgeRegistryEntry<T>>
|
||||
{
|
||||
public final IForgeRegistry<T> registry;
|
||||
private final IForgeRegistry<T> pool;
|
||||
public final ResourceLocation key;
|
||||
public final int id;
|
||||
private Action action = Action.DEFAULT;
|
||||
private T target;
|
||||
|
||||
public Mapping(IForgeRegistry<T> registry, ResourceLocation key, int id)
|
||||
public Mapping(IForgeRegistry<T> registry, IForgeRegistry<T> pool, ResourceLocation key, int id)
|
||||
{
|
||||
this.registry = registry;
|
||||
this.pool = pool;
|
||||
this.key = key;
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -206,7 +208,7 @@ public class RegistryEvent<T extends IForgeRegistryEntry<T>> extends GenericEven
|
|||
public void remap(T target)
|
||||
{
|
||||
Validate.notNull(target, "Remap target can not be null");
|
||||
Validate.isTrue(registry.getKey(target) != null, String.format("The specified entry %s hasn't been registered in registry yet.", target));
|
||||
Validate.isTrue(pool.getKey(target) != null, String.format("The specified entry %s hasn't been registered in registry yet.", target));
|
||||
action = Action.REMAP;
|
||||
this.target = target;
|
||||
}
|
||||
|
|
|
@ -751,7 +751,8 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
|||
public MissingMappings<?> getMissingEvent(ResourceLocation name, Map<ResourceLocation, Integer> map)
|
||||
{
|
||||
List<MissingMappings.Mapping<V>> lst = Lists.newArrayList();
|
||||
map.forEach((rl, id) -> lst.add(new MissingMappings.Mapping<V>(this, rl, id)));
|
||||
ForgeRegistry<V> pool = RegistryManager.ACTIVE.getRegistry(name);
|
||||
map.forEach((rl, id) -> lst.add(new MissingMappings.Mapping<V>(this, pool, rl, id)));
|
||||
return new MissingMappings<V>(name, this, lst);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue