mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Change how black holes function to instead generate energy
This commit is contained in:
parent
5d2478604c
commit
d22dd3bdf9
2 changed files with 21 additions and 17 deletions
|
@ -37,10 +37,6 @@ import net.minecraft.world.World.ExplosionSourceType;
|
|||
|
||||
/**
|
||||
* More powerful version of the vortex spell which creates a black hole.
|
||||
*
|
||||
* TODO: Possible uses
|
||||
* - Garbage bin
|
||||
* - Link with a teleportation spell to create a wormhole
|
||||
*/
|
||||
public class DarkVortexSpell extends AttractiveSpell implements ProjectileDelegate.BlockHitListener {
|
||||
public static final SpellTraits DEFAULT_TRAITS = new SpellTraits.Builder()
|
||||
|
@ -91,10 +87,6 @@ public class DarkVortexSpell extends AttractiveSpell implements ProjectileDelega
|
|||
source.asWorld().playSound(null, source.getOrigin(), USounds.AMBIENT_DARK_VORTEX_ADDITIONS, SoundCategory.AMBIENT, 1, 1);
|
||||
}
|
||||
|
||||
if (!source.subtractEnergyCost(-accumulatedMass)) {
|
||||
setDead();
|
||||
}
|
||||
|
||||
if (!source.isClient() && source.asWorld().random.nextInt(300) == 0) {
|
||||
ParticleUtils.spawnParticle(source.asWorld(), LightningBoltParticleEffect.DEFAULT, getOrigin(source), Vec3d.ZERO);
|
||||
}
|
||||
|
@ -102,6 +94,14 @@ public class DarkVortexSpell extends AttractiveSpell implements ProjectileDelega
|
|||
return super.tick(source, situation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void consumeManage(Caster<?> source, long costMultiplier, float knowledge) {
|
||||
if (!source.subtractEnergyCost(-accumulatedMass)) {
|
||||
setDead();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isFriendlyTogether(Affine other) {
|
||||
return accumulatedMass < 4;
|
||||
|
|
|
@ -97,20 +97,24 @@ public class ShieldSpell extends AbstractSpell {
|
|||
|
||||
long costMultiplier = applyEntities(source);
|
||||
if (costMultiplier > 0) {
|
||||
double cost = 2 - source.getLevel().getScaled(2);
|
||||
|
||||
cost *= costMultiplier / ((1 + source.getLevel().get()) * 3F);
|
||||
cost /= knowledge;
|
||||
cost += getDrawDropOffRange(source) / 10F;
|
||||
|
||||
if (!source.subtractEnergyCost(cost)) {
|
||||
setDead();
|
||||
}
|
||||
consumeManage(source, costMultiplier, knowledge);
|
||||
}
|
||||
|
||||
return !isDead();
|
||||
}
|
||||
|
||||
protected void consumeManage(Caster<?> source, long costMultiplier, float knowledge) {
|
||||
double cost = 2 - source.getLevel().getScaled(2);
|
||||
|
||||
cost *= costMultiplier / ((1 + source.getLevel().get()) * 3F);
|
||||
cost /= knowledge;
|
||||
cost += getDrawDropOffRange(source) / 10F;
|
||||
|
||||
if (!source.subtractEnergyCost(cost)) {
|
||||
setDead();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the maximum radius of the shield. aka The area of effect.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue