diff --git a/src/api/java/de/teamlapen/vampirism/api/entity/IVampirismEntityRegistry.java b/src/api/java/de/teamlapen/vampirism/api/entity/IVampirismEntityRegistry.java index f6a309a27b..236bdd26c7 100755 --- a/src/api/java/de/teamlapen/vampirism/api/entity/IVampirismEntityRegistry.java +++ b/src/api/java/de/teamlapen/vampirism/api/entity/IVampirismEntityRegistry.java @@ -22,7 +22,9 @@ public interface IVampirismEntityRegistry { * Requires a blood value to be registered for that creature * * @param overlay_loc Location of the overlay texture file + * @deprecated use data driven system */ + @Deprecated @ThreadSafeAPI void addConvertible(EntityType type, ResourceLocation overlay_loc); @@ -32,7 +34,10 @@ public interface IVampirismEntityRegistry { * * @param helper Helper instance for the DefaultHandler to specify some values for the converted creature * @param overlay_loc Location of the overlay texture file + * + * @deprecated use data driven system */ + @Deprecated @ThreadSafeAPI void addConvertible(EntityType type, ResourceLocation overlay_loc, IConvertingHandler.IDefaultHelper helper); @@ -42,7 +47,9 @@ public interface IVampirismEntityRegistry { * * @param overlay_loc Location of the overlay texture file. Only required if Vampirism's default Converted Creature renderer is used, if you handle that stuff yourself, null is just fine. * @param handler Handles the conversion + * @deprecated use data driven system */ + @Deprecated @ThreadSafeAPI void addConvertible(EntityType type, ResourceLocation overlay_loc, IConvertingHandler handler); diff --git a/src/main/java/de/teamlapen/vampirism/entity/converted/VampirismEntityRegistry.java b/src/main/java/de/teamlapen/vampirism/entity/converted/VampirismEntityRegistry.java index 56e59b1d43..8a8511bd95 100755 --- a/src/main/java/de/teamlapen/vampirism/entity/converted/VampirismEntityRegistry.java +++ b/src/main/java/de/teamlapen/vampirism/entity/converted/VampirismEntityRegistry.java @@ -33,6 +33,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.HashMap; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -51,9 +52,14 @@ public class VampirismEntityRegistry implements IVampirismEntityRegistry { * Used to store convertible handlers after {@link FMLCommonSetupEvent} */ @NotNull - private final Map, IConvertingHandler> convertibles = new ConcurrentHashMap<>(); + private final Map, IConvertingHandler> convertibles = new HashMap<>(); @NotNull - private final Map, ResourceLocation> convertibleOverlay = new ConcurrentHashMap<>(); + private final Map, ResourceLocation> convertibleOverlay = new HashMap<>(); + + @NotNull + private final Map, IConvertingHandler> convertiblesAPI = new ConcurrentHashMap<>(); + @NotNull + private final Map, ResourceLocation> convertibleOverlayAPI = new ConcurrentHashMap<>(); /** * Stores custom extended creature constructors after {@link InterModEnqueueEvent} */ @@ -85,10 +91,10 @@ public void addConvertible(EntityType type, ResourceLoc @ThreadSafeAPI public void addConvertible(EntityType type, @Nullable ResourceLocation overlay_loc, @NotNull IConvertingHandler handler) { if (finished) throw new IllegalStateException("Register convertibles during InterModEnqueueEvent"); - convertibles.put(type, handler); + convertiblesAPI.put(type, handler); if (FMLEnvironment.dist.isClient() && overlay_loc != null) { - convertibleOverlay.put(type, overlay_loc); + convertibleOverlayAPI.put(type, overlay_loc); } } @@ -183,6 +189,8 @@ public void applyDataConvertibleOverlays(Map public void applyDataConvertibles(Map, ConvertiblesReloadListener.EntityEntry> entries) { this.convertibles.clear(); this.convertibleOverlay.clear(); + this.convertibles.putAll(this.convertiblesAPI); + this.convertibleOverlay.putAll(this.convertibleOverlayAPI); entries.forEach((type, entry) -> { Optional> handler = entry.converter().map(Converter::createHandler); this.convertibles.put(type, handler.orElseGet(() -> new DefaultConverter().createHandler()));