Implement blast modifier support for all applicable constructs, plus misc construct-related cleanup and fixes

This commit is contained in:
Electroblob77
2020-06-28 16:56:18 +01:00
parent 97c21b5057
commit 3a68ba8927
36 changed files with 296 additions and 201 deletions
@@ -1,17 +1,23 @@
package electroblob.wizardry.entity.construct;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.spell.Spell;
import net.minecraft.entity.projectile.EntityTippedArrow;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
public class EntityArrowRain extends EntityMagicConstruct {
public class EntityArrowRain extends EntityScaledConstruct {
public EntityArrowRain(World world){
super(world);
this.height = 3.0f;
this.width = 5.0f;
setSize(Spells.arrow_rain.getProperty(Spell.EFFECT_RADIUS).floatValue() * 2, 5);
}
@Override
protected boolean shouldScaleHeight(){
return false;
}
public void onUpdate(){
@@ -19,14 +25,21 @@ public class EntityArrowRain extends EntityMagicConstruct {
super.onUpdate();
if(!this.world.isRemote){
EntityTippedArrow arrow = new EntityTippedArrow(world, this.posX + rand.nextDouble() * 6 - 3,
this.posY + rand.nextDouble() * 4 - 2, this.posZ + rand.nextDouble() * 6 - 3);
double x = posX + (world.rand.nextDouble() - 0.5D) * (double)width;
double y = posY + world.rand.nextDouble() * (double)height;
double z = posZ + (world.rand.nextDouble() - 0.5D) * (double)width;
EntityTippedArrow arrow = new EntityTippedArrow(world, x, y, z);
arrow.motionX = MathHelper.cos((float)Math.toRadians(this.rotationYaw + 90));
arrow.motionY = -0.6;
arrow.motionZ = MathHelper.sin((float)Math.toRadians(this.rotationYaw + 90));
arrow.shootingEntity = this.getCaster();
arrow.setDamage(7.0d * damageMultiplier);
arrow.setPotionEffect(new ItemStack(Items.ARROW));
this.world.spawnEntity(arrow);
}
}