mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-24 05:47:59 +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.
|
* 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;
|
||||||
|
|
|
@ -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.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue