66import lombok .experimental .ExtensionMethod ;
77import net .lopymine .pe .capture .ParticleCaptures ;
88import net .lopymine .pe .client .ParticleEffectsClient ;
9+ import net .lopymine .pe .compat .LoadedMods ;
910import net .lopymine .pe .extension .RegistryExtension ;
1011import net .lopymine .pe .particle .TexturedParticleFactory ;
1112import net .minecraft .client .particle .Particle ;
5152@ ExtensionMethod (RegistryExtension .class )
5253public class ParticleEffectsManager {
5354
55+ public static boolean redirectEnabled = false ;
56+ public static boolean redirectToVanillaEffectColors = true ;
57+
5458 //? if fabric {
5559 private static final List <ParticleOptions > REGISTERED_PARTICLE_TYPES = new ArrayList <>();
5660 private static final Map <MobEffect , ParticleOptions > EFFECT_TO_PARTICLE = new HashMap <>();
@@ -201,7 +205,19 @@ public static void registerParticleColorsForTypes() {
201205 .toList ();
202206 //?}
203207
204- COLOR_TO_PARTICLES_MAP .put (color , particleEffects );
208+ List <ParticleOptions > list = COLOR_TO_PARTICLES_MAP .get (color );
209+ if (list != null ) {
210+ if (ParticleEffects .getConfig ().isDebugLogEnabled ()) {
211+ //? if >=1.21.4 {
212+ String potionName = potion .name ();
213+ //?} else {
214+ /*String potionName = potion.name;
215+ */ //?}
216+ ParticleEffects .LOGGER .warn ("[DEV/Potion Registration] Found registered effects for color {} from {} potion, skipping its registration. If you just mod user, ignore it." , color , potionName );
217+ }
218+ } else {
219+ COLOR_TO_PARTICLES_MAP .put (color , particleEffects );
220+ }
205221 }
206222
207223 //------------------------------------------------------//
@@ -257,7 +273,16 @@ public static void registerParticleFactories(RegisterParticleProvidersEvent even
257273 public static void onCommonSetup(FMLCommonSetupEvent event) {
258274 event.enqueueWork(() -> {
259275 swapParticleTypes();
260- registerParticleColorsForTypes();
276+ if (LoadedMods.isAnyOldPotionsModLoaded()) {
277+ ParticleEffectsManager.redirectEnabled = true;
278+ ParticleEffectsManager.redirectToVanillaEffectColors = true;
279+ ParticleEffectsManager.registerParticleColorsForTypes();
280+ ParticleEffectsManager.redirectToVanillaEffectColors = false;
281+ ParticleEffectsManager.registerParticleColorsForTypes();
282+ ParticleEffectsManager.redirectEnabled = false;
283+ } else {
284+ registerParticleColorsForTypes();
285+ }
261286 });
262287 }
263288 */ //?}
@@ -274,7 +299,16 @@ public static void onRegisterParticleProviders(RegisterParticleProvidersEvent ev
274299 public static void onCommonSetup(FMLCommonSetupEvent event) {
275300 event.enqueueWork(() -> {
276301 swapParticleTypes();
277- registerParticleColorsForTypes();
302+ if (LoadedMods.isAnyOldPotionsModLoaded()) {
303+ ParticleEffectsManager.redirectEnabled = true;
304+ ParticleEffectsManager.redirectToVanillaEffectColors = true;
305+ ParticleEffectsManager.registerParticleColorsForTypes();
306+ ParticleEffectsManager.redirectToVanillaEffectColors = false;
307+ ParticleEffectsManager.registerParticleColorsForTypes();
308+ ParticleEffectsManager.redirectEnabled = false;
309+ } else {
310+ registerParticleColorsForTypes();
311+ }
278312 });
279313 }
280314 */ //?}
0 commit comments