use of com.teamwizardry.wizardry.common.network.PacketRenderLightningBolt in project Wizardry by TeamWizardry.
the class ModuleEffectLightning method render.
@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
World world = spell.world;
float yaw = spell.getData(YAW, 0F);
float pitch = spell.getData(PITCH, 0F);
Entity caster = spell.getCaster();
Vec3d target = spell.getTarget();
long seed = spell.getData(SEED, 0L);
double range = spellRing.getAttributeValue(AttributeRegistry.RANGE, spell);
if (target == null)
return;
Vec3d origin = target;
if (caster != null) {
float offX = 0.5f * (float) Math.sin(Math.toRadians(-90.0f - yaw));
float offZ = 0.5f * (float) Math.cos(Math.toRadians(-90.0f - yaw));
origin = new Vec3d(offX, 0, offZ).add(target);
}
RayTraceResult traceResult = new RayTrace(world, PosUtils.vecFromRotations(pitch, yaw), target, range).setSkipBlocks(true).setSkipEntities(true).trace();
PacketHandler.NETWORK.sendToAllAround(new PacketRenderLightningBolt(origin, traceResult.hitVec, seed), new NetworkRegistry.TargetPoint(world.provider.getDimension(), origin.x, origin.y, origin.z, 256));
}
Aggregations