public static Vec3d vecFromRotations(float rotationPitch, float rotationYaw) { return Vec3d.fromPitchYaw(rotationPitch, rotationYaw); }
@ModuleOverride("shape_self_run") public void onRunSelf(@ContextSuper ModuleOverrideSuper ovdSuper, SpellData data, SpellRing shape, @ContextRing SpellRing childRing) { if( ovdSuper.hasSuper() ) ovdSuper.invoke(true, data, shape); World world = data.world; if (world.isRemote) return; Entity caster = data.getCaster(); if (caster == null) return; Vec3d origin = data.getOrigin(); if (origin == null) return; if (!childRing.taxCaster(data, true)) return; double range = childRing.getAttributeValue(AttributeRegistry.RANGE, data); double potency = childRing.getAttributeValue(AttributeRegistry.POTENCY, data) / 2; double duration = childRing.getAttributeValue(AttributeRegistry.DURATION, data); RandUtilSeed rand = new RandUtilSeed(RandUtil.nextLong(100, 100000)); float pitch = rand.nextFloat(-45, 45); float yaw = rand.nextFloat(0, 360); doLightning(rand.nextLong(100, 100000), world, caster, origin, Vec3d.fromPitchYaw(pitch, yaw).normalize().scale(range).add(origin), range, potency, duration); }
@ModuleOverride("shape_zone_run") public void onRunZone(@ContextSuper ModuleOverrideSuper ovdSuper, SpellData data, SpellRing shape, @ContextRing SpellRing childRing) { if( ovdSuper.hasSuper() ) ovdSuper.invoke(true, data, shape); World world = data.world; Entity caster = data.getCaster(); Vec3d targetPos = data.getTargetWithFallback(); if (targetPos == null) return; if (!childRing.taxCaster(data, true)) return; double lightningRange = childRing.getAttributeValue(AttributeRegistry.RANGE, data); double lightningPotency = childRing.getAttributeValue(AttributeRegistry.POTENCY, data) / 2.0; double lightningDuration = childRing.getAttributeValue(AttributeRegistry.DURATION, data); double zoneAoE = shape.getAttributeValue(AttributeRegistry.AREA, data); double zoneRange = shape.getAttributeValue(AttributeRegistry.RANGE, data); Vec3d min = targetPos.subtract(zoneAoE/2, zoneRange/2, zoneAoE/2); Vec3d max = targetPos.add(zoneAoE / 2, zoneRange / 2, zoneAoE / 2); RandUtilSeed rand = new RandUtilSeed(RandUtil.nextLong(100, 100000)); Vec3d from = new Vec3d(rand.nextDouble(min.x, max.x), rand.nextDouble(min.y, max.y), rand.nextDouble(min.z, max.z)); float pitch = (float) (180 * Math.asin(2 * rand.nextDouble() - 1) / Math.PI); float yaw = (float) rand.nextDouble(360); Vec3d to = Vec3d.fromPitchYaw(pitch, yaw).normalize().scale(lightningRange).add(from); doLightning(rand.nextLong(100, 100000), world, caster, from, to, lightningRange, lightningPotency, lightningDuration); }
@ModuleOverride("shape_cone_run") public void onRunCone(@ContextSuper ModuleOverrideSuper ovdSuper, SpellData data, SpellRing shape, @ContextRing SpellRing childRing) { if( ovdSuper.hasSuper() ) ovdSuper.invoke(true, data, shape); World world = data.world; float yaw = data.getData(YAW, 0F); float pitch = data.getData(PITCH, 0F); Vec3d origin = data.getOriginHand(); Entity caster = data.getCaster(); if (origin == null) return; if (!childRing.taxCaster(data, true)) return; double coneRange = shape.getAttributeValue(AttributeRegistry.RANGE, data); double lightningRange = childRing.getAttributeValue(AttributeRegistry.RANGE, data); double lightningPotency = childRing.getAttributeValue(AttributeRegistry.POTENCY, data); double lightningDuration = childRing.getAttributeValue(AttributeRegistry.DURATION, data); RandUtilSeed rand = new RandUtilSeed(RandUtil.nextLong(100, 100000)); float angle = (float) coneRange * 2; float newPitch = pitch + rand.nextFloat(-angle, angle); float newYaw = yaw + rand.nextFloat(-angle, angle); Vec3d to = Vec3d.fromPitchYaw(newPitch, newYaw).normalize().scale(coneRange).add(origin); doLightning(rand.nextLong(100, 100000), world, caster, origin, to, lightningRange, lightningPotency, lightningDuration); }