use of com.integral.enigmaticlegacy.entities.UltimateWitherSkullEntity in project Enigmatic-Legacy by Aizistral-Studios.
the class AngelBlessing method redirect.
public void redirect(LivingEntity bearer, Entity redirected) {
if (redirected instanceof UltimateWitherSkullEntity || redirected instanceof WitherSkullEntity)
return;
/*if (redirected instanceof TridentEntity)
if (((TridentEntity)redirected).getShooter() == bearer)
return;*/
Vector3 entityPos = Vector3.fromEntityCenter(redirected);
Vector3 bearerPos = Vector3.fromEntityCenter(bearer);
Vector3 redirection = entityPos.subtract(bearerPos);
redirection = redirection.normalize();
if (redirected instanceof AbstractArrowEntity && ((AbstractArrowEntity) redirected).getShooter() == bearer) {
if (redirected instanceof TridentEntity) {
TridentEntity trident = (TridentEntity) redirected;
if (trident.returningTicks > 0)
return;
}
redirected.setMotion(redirected.getMotion().x * 1.75D, redirected.getMotion().y * 1.75D, redirected.getMotion().z * 1.75D);
} else
redirected.setMotion(redirection.x, redirection.y, redirection.z);
if (redirected instanceof DamagingProjectileEntity) {
DamagingProjectileEntity redirectedProjectile = (DamagingProjectileEntity) redirected;
redirectedProjectile.accelerationX = (redirection.x / 4.0);
redirectedProjectile.accelerationY = (redirection.y / 4.0);
redirectedProjectile.accelerationZ = (redirection.z / 4.0);
}
}
use of com.integral.enigmaticlegacy.entities.UltimateWitherSkullEntity in project Enigmatic-Legacy by Aizistral-Studios.
the class EnigmaticItem method launchWitherSkull.
private void launchWitherSkull(World world, PlayerEntity player, boolean invulnerable) {
world.playEvent((PlayerEntity) null, 1024, new BlockPos(player), 0);
Vector3 look = new Vector3(player.getLookVec()).multiply(1, 0, 1);
double playerRot = Math.toRadians(player.rotationYaw + 90);
if (look.x == 0 && look.z == 0)
look = new Vector3(Math.cos(playerRot), 0, Math.sin(playerRot));
look = look.normalize().multiply(-2);
double div = -0.75 + (random.nextDouble() * 0.75);
double mod = -0.5D + (random.nextDouble() * 6D);
Vector3 pl = look.add(Vector3.fromEntityCenter(player)).add(0, 1.6, div * 0.1);
Vector3 axis = look.normalize().crossProduct(new Vector3(-1, 0, -1)).normalize();
double rot = mod * Math.PI / 4D - Math.PI / 2D;
Vector3 axis1 = axis.multiply(div * 3.5D + 5D).rotate(rot, look);
if (axis1.y < 0)
axis1 = axis1.multiply(1, -1, 1);
Vector3 end = pl.add(axis1);
// end = end.add(0, -1, 0);\
UltimateWitherSkullEntity witherskullentity = new UltimateWitherSkullEntity(world, player);
if (invulnerable) {
witherskullentity.setSkullInvulnerable(true);
}
witherskullentity.posX = end.x;
witherskullentity.posY = end.y;
witherskullentity.posZ = end.z;
world.addEntity(witherskullentity);
EnigmaticLegacy.packetInstance.send(PacketDistributor.NEAR.with(() -> new PacketDistributor.TargetPoint(witherskullentity.posX, witherskullentity.posY, witherskullentity.posZ, 64, witherskullentity.dimension)), new PacketWitherParticles(witherskullentity.posX, witherskullentity.posY + (witherskullentity.getHeight() / 2), witherskullentity.posZ, 8, false));
}
Aggregations