-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathModuleEffectTimeLock.java
More file actions
72 lines (53 loc) · 2.31 KB
/
ModuleEffectTimeLock.java
File metadata and controls
72 lines (53 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.teamwizardry.wizardry.common.module.effects;
/**
* Created by Demoniaque.
*/
/*
@RegisterModule(ID = "effect_time_lock")
public class ModuleEffectTimeLock implements IModuleEffect, IDelayedModule {
public static HashMultimap<UUID, UUID> timeLockedEntities = HashMultimap.create();
@Override
public String[] compatibleModifiers() {
return new String[]{"modifier_extend_time"};
}
@Override
public boolean run(@NotNull World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
Entity targetEntity = spell.getVictim(world);
Entity caster = spell.getCaster(world);
if (caster == null) return true;
double time = spellRing.getAttributeValue(world, AttributeRegistry.DURATION, spell);
if (!spellRing.taxCaster(world, spell, true)) return false;
NemezTracker nemezDrive = WizardryNemezManager.getOrCreateNemezDrive(world, caster);
if (targetEntity instanceof EntityLivingBase) {
timeLockedEntities.put(caster.getUniqueID(), targetEntity.getUniqueID());
((EntityLivingBase) targetEntity).addPotionEffect(new PotionEffect(ModPotions.TIME_LOCK, (int) time, 1, false, false));
world.playSound(null, targetEntity.getPosition(), ModSounds.SOUND_BOMB, SoundCategory.NEUTRAL, RandUtil.nextFloat(0.35f, 0.75f), RandUtil.nextFloat(0.35f, 1.5f));
}
addDelayedSpell(world, spellRing, spell, (int) time);
return true;
}
@Override
public void runDelayedEffect(@Nonnull World world, SpellData spell, SpellRing spellRing) {
Entity caster = spell.getCaster(world);
if (caster == null) return;
BlockPos targetPos = spell.getTargetPos();
if (targetPos == null) return;
NemezTracker nemezDrive = WizardryNemezManager.getAndRemoveNemezDrive(world, caster);
if (nemezDrive != null) {
nemezDrive.endUpdate();
nemezDrive.collapse();
NemezEventHandler.reverseTime(world, nemezDrive, targetPos);
}
timeLockedEntities.removeAll(caster.getUniqueID());
}
@Override
@SideOnly(Side.CLIENT)
public void renderSpell(World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
Vec3d position = spell.getTarget(world);
if (position == null) return;
Color color = instance.getPrimaryColor();
if (RandUtil.nextBoolean()) color = instance.getSecondaryColor();
LibParticles.EFFECT_BURN(world, position, color);
}
}
*/