If you build a ParticleEffect...
ParticleEffect baseEffect = ParticleEffect.builder()
.type(ParticleTypes.DRAGON_BREATH)
.quantity(50)
.offset(Vector3d.ONE)
.velocity(Vector3d.ONE)
.build();
... and from this one, try to create a new builder ...
ParticleEffect.builder()
.from(baseEffect) // <- this causes the exception, i think
.quantity(4) // <- this throws the exception
.type(ParticleTypes.CRITICAL_HIT)
.velocity(Vector3d.ZERO)
.build()
It throws this Exception:
java.lang.UnsupportedOperationException
at com.google.common.collect.ImmutableMap.put(ImmutableMap.java:326) ~[guava-17.0.jar:?]
at org.spongepowered.common.effect.particle.SpongeParticleEffectBuilder.option(SpongeParticleEffectBuilder.java:108) ~[SpongeParticleEffectBuilder.class:?]
at org.spongepowered.api.effect.particle.ParticleEffect$Builder.quantity(ParticleEffect.java:149) ~[ParticleEffect$Builder.class:?]
at de.craftednature.sponge.cnplugin.test.TestModul.test2(TestModul.java:41) ~[TestModul.class:?]
I think this is because the SpongeParticleEffectBuilder class tries to modify an ImmutableMap:
https://github.com/SpongePowered/SpongeCommon/blob/bleeding/src/main/java/org/spongepowered/common/effect/particle/SpongeParticleEffectBuilder.java#L79
__(particleEffect.getOptions() returns an ImmutableMap!)__
I found this issue in my development environment, so i don't have any Sponge Versions, but it was the Sponge-Forge Version built from the bleeding branch.
Minecraft: 1.10.2
Minecraft Forge: 12.18.2.2107
This is my mistake, I will fix this in: https://github.com/SpongePowered/SpongeCommon/pull/986
Most helpful comment
This is my mistake, I will fix this in: https://github.com/SpongePowered/SpongeCommon/pull/986