// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.spawning.world.system;

import com.hypixel.hytale.server.spawning.world.WorldEnvironmentSpawnData;
import com.hypixel.hytale.component.system.EcsEvent;
import com.hypixel.hytale.server.spawning.world.component.WorldSpawnData;
import com.hypixel.hytale.component.CommandBuffer;
import javax.annotation.Nonnull;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.universe.world.events.ecs.MoonPhaseChangeEvent;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.component.system.WorldEventSystem;

public class MoonPhaseChangeEventSystem extends WorldEventSystem<EntityStore, MoonPhaseChangeEvent>
{
    public MoonPhaseChangeEventSystem() {
        super(MoonPhaseChangeEvent.class);
    }
    
    @Override
    public void handle(@Nonnull final Store<EntityStore> store, @Nonnull final CommandBuffer<EntityStore> commandBuffer, @Nonnull final MoonPhaseChangeEvent event) {
        final WorldSpawnData worldSpawnDataResource = commandBuffer.getResource(WorldSpawnData.getResourceType());
        worldSpawnDataResource.forEachEnvironmentSpawnData(worldEnvironmentSpawnData -> worldEnvironmentSpawnData.recalculateWeight(event.getNewMoonPhase()));
    }
}
