use of org.spongepowered.common.effect.particle.SpongeParticleType in project SpongeCommon by SpongePowered.
the class AreaEffectCloudDataProcessor method set.
@SuppressWarnings("unchecked")
@Override
protected boolean set(EntityAreaEffectCloud dataHolder, Map<Key<?>, Object> keyValues) {
final int age = (int) keyValues.get(Keys.AREA_EFFECT_CLOUD_AGE);
final Color color = (Color) keyValues.get(Keys.AREA_EFFECT_CLOUD_COLOR);
final double radius = (double) keyValues.get(Keys.AREA_EFFECT_CLOUD_RADIUS);
final double radiusOnUse = (double) keyValues.get(Keys.AREA_EFFECT_CLOUD_RADIUS_ON_USE);
final int duration = (int) keyValues.get(Keys.AREA_EFFECT_CLOUD_DURATION);
final int durationOnUse = (int) keyValues.get(Keys.AREA_EFFECT_CLOUD_DURATION_ON_USE);
final int waitTime = (int) keyValues.get(Keys.AREA_EFFECT_CLOUD_WAIT_TIME);
final int reapplicationDelay = (int) keyValues.get(Keys.AREA_EFFECT_CLOUD_REAPPLICATION_DELAY);
final List<PotionEffect> potionEffects = (List<PotionEffect>) keyValues.get(Keys.POTION_EFFECTS);
final ParticleType particleType = (ParticleType) keyValues.get(Keys.AREA_EFFECT_CLOUD_PARTICLE_TYPE);
dataHolder.ticksExisted = age;
dataHolder.setColor(color.getRgb());
dataHolder.setRadius((float) radius);
dataHolder.setRadiusOnUse((float) radiusOnUse);
dataHolder.setDuration(duration);
((IMixinAreaEffectCloud) dataHolder).setDurationOnUse(durationOnUse);
dataHolder.setWaitTime(waitTime);
final EnumParticleTypes internalType = ((SpongeParticleType) particleType).getInternalType();
dataHolder.setParticle(internalType == null ? EnumParticleTypes.SPELL_MOB : internalType);
final List<net.minecraft.potion.PotionEffect> effects = new ArrayList<>();
for (PotionEffect effect : potionEffects) {
effects.add((net.minecraft.potion.PotionEffect) effect);
}
((IMixinAreaEffectCloud) dataHolder).setPotionEffects(effects);
((IMixinAreaEffectCloud) dataHolder).setReapplicationDelay(reapplicationDelay);
return true;
}
use of org.spongepowered.common.effect.particle.SpongeParticleType in project SpongeCommon by SpongePowered.
the class AreaEffectCloudParticleTypeProcessor method set.
@Override
protected boolean set(EntityAreaEffectCloud container, ParticleType value) {
final EnumParticleTypes internalType = ((SpongeParticleType) value).getInternalType();
if (internalType == null) {
return false;
}
container.setParticle(internalType);
return true;
}
use of org.spongepowered.common.effect.particle.SpongeParticleType in project SpongeCommon by SpongePowered.
the class ParticleRegistryModule method addEffectType.
private void addEffectType(String id, @Nullable EnumParticleTypes internalType, Map<ParticleOption<?>, Object> options) {
SpongeParticleType particleType = new SpongeParticleType("minecraft:" + id, id, internalType, options);
this.particleMappings.put(id, particleType);
this.particleByName.put(particleType.getId().toLowerCase(Locale.ENGLISH), particleType);
}
Aggregations