Add stormcloud spell

This commit is contained in:
Electroblob77
2020-05-18 20:41:41 +01:00
parent ebde514c98
commit 650344a0c8
11 changed files with 191 additions and 1 deletions
@@ -795,6 +795,7 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityStormElemental.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityEarthquake.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityHailstorm.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityStormcloud.class, RenderBlank::new);
// Runes on ground
RenderingRegistry.registerEntityRenderingHandler(EntityHealAura.class,
@@ -0,0 +1,122 @@
package electroblob.wizardry.entity.construct;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.WizardryUtilities;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.World;
import java.util.List;
public class EntityStormcloud extends EntityMagicConstruct {
// private static final DataParameter<Float> RADIUS = new DataParameter<>(21, DataSerializers.FLOAT);
public EntityStormcloud(World world){
super(world);
this.height = 2.0f;
this.width = Spells.stormcloud.getProperty(Spell.EFFECT_RADIUS).floatValue() * 2;
}
// @Override
// protected void entityInit(){
// super.entityInit();
// this.getDataManager().register(RADIUS, width); // TODO: This doesn't work, implement blast modifiers properly into SpellConstruct
// }
// public void multiplyWidth(float multiplier){
// this.setSize(width * multiplier, height);
// this.getDataManager().set(RADIUS, width);
// }
public void onUpdate(){
super.onUpdate();
// if(world.isRemote){
// float radius = this.getDataManager().get(RADIUS);
// if(radius != width) this.setSize(radius, height);
// }else{
// if(this.getDataManager().get(RADIUS) != width) this.getDataManager().set(RADIUS, width);
// }
// if(this.ticksExisted % 35 == 0) this.playSound(WizardrySounds.ENTITY_STORMCLOUD_AMBIENT, 1, 1);
if(this.world.isRemote){
float areaFactor = (width * width) / 36; // Ensures cloud/raindrop density stays the same for different sizes
for(int i = 0; i < 2 * areaFactor; i++) ParticleBuilder.create(Type.CLOUD, this)
.clr(0.3f, 0.3f, 0.3f).shaded(true).spawn(world);
}
List<EntityLivingBase> targets = world.getEntitiesWithinAABB(EntityLivingBase.class,
this.getEntityBoundingBox().expand(0, -10, 0));
float damage = Spells.stormcloud.getProperty(Spell.DAMAGE).floatValue() * this.damageMultiplier;
for(EntityLivingBase target : targets){
if(this.isValidTarget(target)){
if(target.ticksExisted % 150 == 0){ // Use target's lifetime so they don't all get hit at once, looks better
if(!this.world.isRemote){
WizardryUtilities.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(
this, this.getCaster(), MagicDamage.DamageType.SHOCK), damage);
}else{
ParticleBuilder.create(Type.LIGHTNING).pos(target.posX, posY + height/2, target.posZ)
.target(target).scale(2).spawn(world);
ParticleBuilder.spawnShockParticles(world, target.posX, target.getEntityBoundingBox().minY + target.height, target.posZ);
}
target.playSound(WizardrySounds.ENTITY_STORMCLOUD_THUNDER, 1, 1.6f);
target.playSound(WizardrySounds.ENTITY_STORMCLOUD_ATTACK, 1, 1);
}
}
}
// BlockPos pos = new BlockPos(this);
//
// for(int x = -(int)(this.width/2); x <= this.width/2 + 0.5; x++){
// for(int z = -(int)(this.width/2); z <= this.width/2 + 0.5; z++){
//
// int y = WizardryUtilities.getNearestFloor()
//
// }
// }
}
// Need to sync the caster so they don't have particles spawned at them
@Override
public void writeSpawnData(ByteBuf data){
super.writeSpawnData(data);
if(getCaster() != null) data.writeInt(getCaster().getEntityId());
}
@Override
public void readSpawnData(ByteBuf data){
super.readSpawnData(data);
if(!data.isReadable()) return;
Entity entity = world.getEntityByID(data.readInt());
if(entity instanceof EntityLivingBase){
setCaster((EntityLivingBase)entity);
}else{
Wizardry.logger.warn("Stormcloud caster with ID in spawn data not found");
}
}
}
@@ -8,7 +8,6 @@ import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.spell.*;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumAction;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
@@ -239,6 +238,10 @@ public final class Spells {
public static final Spell slow_time = placeholder();
public static final Spell resurrection = placeholder();
// Wizardry 4.3 spells
public static final Spell stormcloud = placeholder();
@SubscribeEvent
public static void register(RegistryEvent.Register<Spell> event){
@@ -437,6 +440,11 @@ public final class Spells {
registry.register(new SpeedTime());
registry.register(new SlowTime());
registry.register(new Resurrection());
// Wizardry 4.3 spells
registry.register(new Stormcloud());
}
}
@@ -150,6 +150,7 @@ public class WizardryEntities {
registry.register(createEntry(EntityArrowRain.class, "arrow_rain", TrackingType.CONSTRUCT).build());
registry.register(createEntry(EntityEarthquake.class, "earthquake", TrackingType.CONSTRUCT).build());
registry.register(createEntry(EntityHailstorm.class, "hailstorm", TrackingType.CONSTRUCT).build());
registry.register(createEntry(EntityStormcloud.class, "stormcloud", TrackingType.CONSTRUCT).build());
// These ones move, velocity updates are sent if that's not at constant velocity
registry.register(createEntry(EntityShield.class, "shield") .tracker(160, 10, true).build());
@@ -86,6 +86,8 @@ public final class WizardrySounds {
public static final SoundEvent ENTITY_STORM_ELEMENTAL_WIND = createSound("entity.storm_elemental.wind");
public static final SoundEvent ENTITY_STORM_ELEMENTAL_HURT = createSound("entity.storm_elemental.hurt");
public static final SoundEvent ENTITY_STORM_ELEMENTAL_DEATH = createSound("entity.storm_elemental.death");
public static final SoundEvent ENTITY_STORMCLOUD_THUNDER = createSound("entity.stormcloud.thunder");
public static final SoundEvent ENTITY_STORMCLOUD_ATTACK = createSound("entity.stormcloud.attack");
public static final SoundEvent ENTITY_WIZARD_YES = createSound("entity.wizard.yes");
public static final SoundEvent ENTITY_WIZARD_NO = createSound("entity.wizard.no");
public static final SoundEvent ENTITY_WIZARD_AMBIENT = createSound("entity.wizard.ambient");
@@ -0,0 +1,22 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.entity.construct.EntityStormcloud;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumFacing;
import javax.annotation.Nullable;
public class Stormcloud extends SpellConstructRanged<EntityStormcloud> {
public Stormcloud(){
super("stormcloud", EntityStormcloud::new, false);
this.addProperties(DAMAGE, EFFECT_RADIUS);
this.floor(true);
}
@Override
protected void addConstructExtras(EntityStormcloud construct, EnumFacing side, @Nullable EntityLivingBase caster, SpellModifiers modifiers){
construct.posY += 5;
}
}
@@ -485,6 +485,7 @@ entity.ebwizardry\:ring_of_fire.name=Ring of Fire
entity.ebwizardry\:earthquake.name=Earthquake
entity.ebwizardry\:hailstorm.name=Hailstorm
entity.ebwizardry\:lightning_pulse.name=Lightning Pulse
entity.ebwizardry\:stormcloud.name=Stormcloud
itemGroup.ebwizardry=Wizardry
itemGroup.ebwizardryspells=Spells
@@ -747,6 +748,7 @@ spell.ebwizardry\:spectral_pathway=Spectral Pathway
spell.ebwizardry\:speed_time=Speed Time
spell.ebwizardry\:spider_swarm=Spider Swarm
spell.ebwizardry\:static_aura=Static Aura
spell.ebwizardry\:stormcloud=Stormcloud
spell.ebwizardry\:summon_blaze=Summon Blaze
spell.ebwizardry\:summon_ice_giant=Summon Ice Giant
spell.ebwizardry\:summon_ice_wraith=Summon Ice Wraith
@@ -921,6 +923,7 @@ spell.ebwizardry\:spectral_pathway.desc=Creates an indestructible magical bridge
spell.ebwizardry\:speed_time.desc=...day, night, dawn, dusk, sunrise and sunset\: thus is the passage of time, which traps us in an endless cycle of...
spell.ebwizardry\:spider_swarm.desc=Summons a swarm of venomous spiders to fight for you. The spiders will disappear after 30 seconds or if they are killed.
spell.ebwizardry\:static_aura.desc=Surrounds the caster with lightning for 30 seconds, firing a spark of lightning at anything that hits them.
spell.ebwizardry\:stormcloud.desc=Conjures a floating stormcloud where you are pointing that strikes lightning beneath it.
spell.ebwizardry\:summon_blaze.desc=Summons a blaze to fight for you. The blaze will disappear after 30 seconds or if it is killed.
spell.ebwizardry\:summon_ice_giant.desc="Smash them!"
spell.ebwizardry\:summon_ice_wraith.desc=Summons an ice wraith to fight for you. The ice wraith will disappear after 30 seconds or if it is killed.
@@ -485,6 +485,7 @@ entity.ebwizardry\:ring_of_fire.name=Ring of Fire
entity.ebwizardry\:earthquake.name=Earthquake
entity.ebwizardry\:hailstorm.name=Hailstorm
entity.ebwizardry\:lightning_pulse.name=Lightning Pulse
entity.ebwizardry\:stormcloud.name=Stormcloud
itemGroup.ebwizardry=Wizardry
itemGroup.ebwizardryspells=Spells
@@ -747,6 +748,7 @@ spell.ebwizardry\:spectral_pathway=Spectral Pathway
spell.ebwizardry\:speed_time=Speed Time
spell.ebwizardry\:spider_swarm=Spider Swarm
spell.ebwizardry\:static_aura=Static Aura
spell.ebwizardry\:stormcloud=Stormcloud
spell.ebwizardry\:summon_blaze=Summon Blaze
spell.ebwizardry\:summon_ice_giant=Summon Ice Giant
spell.ebwizardry\:summon_ice_wraith=Summon Ice Wraith
@@ -921,6 +923,7 @@ spell.ebwizardry\:spectral_pathway.desc=Creates an indestructible magical bridge
spell.ebwizardry\:speed_time.desc=...day, night, dawn, dusk, sunrise and sunset\: thus is the passage of time, which traps us in an endless cycle of...
spell.ebwizardry\:spider_swarm.desc=Summons a swarm of venomous spiders to fight for you. The spiders will disappear after 30 seconds or if they are killed.
spell.ebwizardry\:static_aura.desc=Surrounds the caster with lightning for 30 seconds, firing a spark of lightning at anything that hits them.
spell.ebwizardry\:stormcloud.desc=Conjures a floating stormcloud where you are pointing that strikes lightning beneath it.
spell.ebwizardry\:summon_blaze.desc=Summons a blaze to fight for you. The blaze will disappear after 30 seconds or if it is killed.
spell.ebwizardry\:summon_ice_giant.desc="Smash them!"
spell.ebwizardry\:summon_ice_wraith.desc=Summons an ice wraith to fight for you. The ice wraith will disappear after 30 seconds or if it is killed.
@@ -33,6 +33,8 @@
"entity.lightning_sigil.trigger": {"category": "spells", "sounds": ["ebwizardry:arc1", "ebwizardry:arc2", "ebwizardry:arc3"]},
"entity.meteor.falling": {"category": "spells", "sounds": ["ebwizardry:flames_loop"]},
"entity.shield.deflect": {"category": "spells", "sounds": ["ebwizardry:effect1", "ebwizardry:effect2"]},
"entity.stormcloud.thunder": {"category": "spells", "sounds": ["ambient/weather/thunder1", "ambient/weather/thunder2", "ambient/weather/thunder3"]},
"entity.stormcloud.attack": {"category": "spells", "sounds": ["ebwizardry:arc1", "ebwizardry:arc2", "ebwizardry:arc3"]},
"entity.tornado.ambient": {"category": "spells", "sounds": ["ebwizardry:wind"]},
"entity.evil_wizard.ambient": {"category": "hostile", "sounds": ["mob/evocation_illager/idle1", "mob/evocation_illager/idle2", "mob/evocation_illager/idle3", "mob/evocation_illager/idle4"]},
@@ -285,6 +287,7 @@
"spell.spider_swarm": {"category": "spells", "sounds": ["random/fizz"]},
"spell.static_aura": {"category": "spells", "sounds": ["ebwizardry:buff"]},
"spell.static_aura.retaliate": {"category": "spells", "sounds": ["ebwizardry:arc1", "ebwizardry:arc2", "ebwizardry:arc3"]},
"spell.stormcloud": {"category": "spells", "sounds": ["ambient/weather/thunder1", "ambient/weather/thunder2", "ambient/weather/thunder3"]},
"spell.summon_blaze": {"category": "spells", "sounds": ["mob/wither/idle1", "mob/wither/idle2", "mob/wither/idle3", "mob/wither/idle4"]},
"spell.summon_ice_giant": {"category": "spells", "sounds": ["mob/evocation_illager/prepare_summon"]},
"spell.summon_ice_wraith": {"category": "spells", "sounds": ["mob/wither/idle1", "mob/wither/idle2", "mob/wither/idle3", "mob/wither/idle4"]},
@@ -0,0 +1,25 @@
{
"enabled": {
"book": true,
"scroll": true,
"wands": true,
"npcs": true,
"dispensers": true,
"commands": true,
"treasure": true,
"trades": true,
"looting": true
},
"tier": "advanced",
"element": "lightning",
"type": "construct",
"cost": 60,
"chargeup": 0,
"cooldown": 150,
"base_properties": {
"duration": 600,
"range": 10,
"damage": 8,
"effect_radius": 3
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB