use of mcjty.rftoolsdim.dimensions.types.EffectType in project RFToolsDimensions by McJty.
the class DimensionTickEvent method handleEffectsForDimension.
private void handleEffectsForDimension(int power, int id, DimensionInformation information) {
WorldServer world = DimensionManager.getWorld(id);
if (world != null) {
Set<EffectType> effects = information.getEffectTypes();
List<EntityPlayer> players = new ArrayList<EntityPlayer>(world.playerEntities);
for (EntityPlayer player : players) {
for (EffectType effect : effects) {
Integer potionEffect = effectsMap.get(effect);
if (potionEffect != null) {
Integer amplifier = effectAmplifierMap.get(effect);
if (amplifier == null) {
amplifier = 0;
}
player.addPotionEffect(new PotionEffect(potionEffect, EFFECTS_MAX * MAXTICKS * 3, amplifier, true, true));
} else if (effect == EffectType.EFFECT_FLIGHT) {
// BuffProperties.addBuff(player, PlayerBuff.BUFF_FLIGHT, EFFECTS_MAX * MAXTICKS * 2);
// @todo
}
}
if (power < PowerConfiguration.DIMPOWER_WARN3) {
// We are VERY low on power. Start bad effects.
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 4, true, true));
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 4, true, true));
player.addPotionEffect(new PotionEffect(Potion.poison.getId(), EFFECTS_MAX * MAXTICKS, 2, true, true));
player.addPotionEffect(new PotionEffect(Potion.hunger.getId(), EFFECTS_MAX * MAXTICKS, 2, true, true));
} else if (power < PowerConfiguration.DIMPOWER_WARN2) {
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 2, true, true));
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 2, true, true));
player.addPotionEffect(new PotionEffect(Potion.hunger.getId(), EFFECTS_MAX * MAXTICKS, 1, true, true));
} else if (power < PowerConfiguration.DIMPOWER_WARN1) {
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 0, true, true));
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 0, true, true));
}
}
}
}
use of mcjty.rftoolsdim.dimensions.types.EffectType in project RFToolsDimensions by McJty.
the class EffectDimletType method inject.
@Override
public void inject(DimletKey key, DimensionInformation dimensionInformation) {
Set<EffectType> effectTypes = dimensionInformation.getEffectTypes();
EffectType effectType = DimletObjectMapping.getEffect(key);
if (EffectType.EFFECT_NONE.equals(effectType)) {
effectTypes.clear();
} else {
effectTypes.add(effectType);
}
}
use of mcjty.rftoolsdim.dimensions.types.EffectType in project RFToolsDimensions by McJty.
the class EffectDimletType method constructDimension.
@Override
public void constructDimension(List<Pair<DimletKey, List<DimletKey>>> dimlets, Random random, DimensionInformation dimensionInformation) {
Set<EffectType> effectTypes = dimensionInformation.getEffectTypes();
dimlets = DimensionInformation.extractType(DimletType.DIMLET_EFFECT, dimlets);
if (dimlets.isEmpty()) {
while (random.nextFloat() < WorldgenConfiguration.randomEffectChance) {
DimletKey key = DimletRandomizer.getRandomEffect(random);
if (key != null) {
EffectType effectType = DimletObjectMapping.getEffect(key);
if (!effectTypes.contains(effectType)) {
dimensionInformation.updateCostFactor(key);
effectTypes.add(effectType);
}
}
}
} else {
for (Pair<DimletKey, List<DimletKey>> dimletWithModifier : dimlets) {
DimletKey key = dimletWithModifier.getLeft();
EffectType effectType = DimletObjectMapping.getEffect(key);
if (effectType != EffectType.EFFECT_NONE) {
effectTypes.add(effectType);
}
}
}
}
Aggregations