Damage modifier support for vanilla entities (throwables, shulker bullet and fangs)

This commit is contained in:
Electroblob77
2020-06-30 15:11:27 +01:00
parent 6a8951ab39
commit 148f527504
3 changed files with 51 additions and 2 deletions
@@ -78,7 +78,7 @@ public class ShulkerBullet extends Spell {
if(caster != null){
world.spawnEntity(new EntityShulkerBullet(world, caster, target, direction.getAxis()));
}else{
// Can't use the normal constructor because doesn't accept null for the owner
// Can't use the normal constructor because it doesn't accept null for the owner
EntityShulkerBullet bullet = new EntityShulkerBullet(world);
bullet.setLocationAndAngles(x, y, z, bullet.rotationYaw, bullet.rotationPitch);
@@ -94,6 +94,8 @@ public class ShulkerBullet extends Spell {
NBTExtras.storeTagSafely(nbt, "Target", targetTag);
bullet.readFromNBT(nbt); // LOL I just modified private fields without reflection
bullet.getEntityData().setFloat(SpellThrowable.DAMAGE_MODIFIER_NBT_KEY, modifiers.get(SpellModifiers.POTENCY));
world.spawnEntity(bullet);
}
}