Search in sources :

Example 1 with ClientContent

use of io.xol.chunkstories.api.client.ClientContent in project chunkstories-core by Hugobros3.

the class ParticleLightningStrike method getRenderer.

@Override
public ParticleTypeRenderer getRenderer(ParticlesRenderer particlesRenderer) {
    return new ParticleTypeRenderer(particlesRenderer) {

        @Override
        public void forEach_Rendering(RenderingInterface renderingContext, ParticleData data) {
            Content content = ParticleLightningStrike.this.getType().store().parent();
            if (content instanceof ClientContent) {
                ClientContent clientContent = (ClientContent) content;
                LocalPlayer player = clientContent.getContext().getPlayer();
                Entity entity = player.getControlledEntity();
                if (entity != null) {
                    Location loc = entity.getLocation();
                    data.set((float) (double) data.x(), (float) (double) loc.y() + 1024, (float) (double) data.z());
                }
            }
            renderingContext.getLightsRenderer().queueLight(new Light(new Vector3f(226 / 255f, 255 / 255f, 226 / 255f).mul((float) (1f + Math.random())), new Vector3f((float) data.x(), (float) data.y(), (float) data.z()), 102004f + (float) Math.random() * 5f));
        }

        @Override
        public void destroy() {
        }
    };
}
Also used : Entity(io.xol.chunkstories.api.entity.Entity) ClientContent(io.xol.chunkstories.api.client.ClientContent) Content(io.xol.chunkstories.api.content.Content) LocalPlayer(io.xol.chunkstories.api.client.LocalPlayer) Light(io.xol.chunkstories.api.rendering.lightning.Light) Vector3f(org.joml.Vector3f) RenderingInterface(io.xol.chunkstories.api.rendering.RenderingInterface) ClientContent(io.xol.chunkstories.api.client.ClientContent) Location(io.xol.chunkstories.api.Location)

Aggregations

Location (io.xol.chunkstories.api.Location)1 ClientContent (io.xol.chunkstories.api.client.ClientContent)1 LocalPlayer (io.xol.chunkstories.api.client.LocalPlayer)1 Content (io.xol.chunkstories.api.content.Content)1 Entity (io.xol.chunkstories.api.entity.Entity)1 RenderingInterface (io.xol.chunkstories.api.rendering.RenderingInterface)1 Light (io.xol.chunkstories.api.rendering.lightning.Light)1 Vector3f (org.joml.Vector3f)1