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. * 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 class DarkVortexSpell extends AttractiveSpell implements ProjectileDelegate.BlockHitListener {
public static final SpellTraits DEFAULT_TRAITS = new SpellTraits.Builder() 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); 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) { if (!source.isClient() && source.asWorld().random.nextInt(300) == 0) {
ParticleUtils.spawnParticle(source.asWorld(), LightningBoltParticleEffect.DEFAULT, getOrigin(source), Vec3d.ZERO); 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); return super.tick(source, situation);
} }
@Override
protected void consumeManage(Caster<?> source, long costMultiplier, float knowledge) {
if (!source.subtractEnergyCost(-accumulatedMass)) {
setDead();
}
}
@Override @Override
public boolean isFriendlyTogether(Affine other) { public boolean isFriendlyTogether(Affine other) {
return accumulatedMass < 4; return accumulatedMass < 4;

View file

@ -97,6 +97,13 @@ public class ShieldSpell extends AbstractSpell {
long costMultiplier = applyEntities(source); long costMultiplier = applyEntities(source);
if (costMultiplier > 0) { if (costMultiplier > 0) {
consumeManage(source, costMultiplier, knowledge);
}
return !isDead();
}
protected void consumeManage(Caster<?> source, long costMultiplier, float knowledge) {
double cost = 2 - source.getLevel().getScaled(2); double cost = 2 - source.getLevel().getScaled(2);
cost *= costMultiplier / ((1 + source.getLevel().get()) * 3F); cost *= costMultiplier / ((1 + source.getLevel().get()) * 3F);
@ -108,9 +115,6 @@ public class ShieldSpell extends AbstractSpell {
} }
} }
return !isDead();
}
/** /**
* Calculates the maximum radius of the shield. aka The area of effect. * Calculates the maximum radius of the shield. aka The area of effect.
*/ */