Change how black holes function to instead generate energy

This commit is contained in:
Sollace 2024-01-19 22:12:22 +00:00
parent 5d2478604c
commit d22dd3bdf9
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
2 changed files with 21 additions and 17 deletions

View file

@ -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;

View file

@ -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.
*/