package codechicken.lib.util.registry;

import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.LegacyNamespacedRegistry;

import javax.annotation.Nullable;
import java.util.HashMap;

public class DuplicateValueRegistry<V> extends LegacyNamespacedRegistry<V> {

    private final LegacyNamespacedRegistry<V> wrapped;
    private final HashMap<V, ResourceLocation> classMap = new HashMap<>();

    public DuplicateValueRegistry(LegacyNamespacedRegistry<V> wrapped) {
        this.wrapped = wrapped;
    }

    @Nullable
    @Override
    public ResourceLocation getNameForObject(V value) {
        if (classMap.containsKey(value)) {
            return classMap.get(value);
        }
        return wrapped.getNameForObject(value);
    }

    public void addMapping(V clazz, ResourceLocation mapping) {
        classMap.put(clazz, mapping);
    }
}

@@ -246,19 +246,16 @@
 Registry
-%3CV%3E
  extends
@@ -279,19 +279,16 @@
 Registry
-%3CV%3E
  %7B%0A%0A    
@@ -317,35 +317,32 @@
 mespacedRegistry
-%3CV%3E
  wrapped;%0A    pr
@@ -361,17 +361,22 @@
 HashMap%3C
-V
+Object
 , Resour
@@ -478,11 +478,8 @@
 stry
-%3CV%3E
  wra
@@ -521,24 +521,60 @@
 ped;%0A    %7D%0A%0A
+    @SuppressWarnings (%22unchecked%22)%0A
     @Nullabl
@@ -634,17 +634,22 @@
 rObject(
-V
+Object
  value) 
@@ -757,16 +757,35 @@
   return
+ (ResourceLocation)
  wrapped
@@ -844,17 +844,22 @@
 Mapping(
-V
+Object
  clazz, 

Fix some bullshit with generics.