Search in sources :

Example 1 with WorldProviderTropicraft

use of net.tropicraft.core.common.dimension.WorldProviderTropicraft in project Tropicraft by Tropicraft.

the class MiscEvents method tickServer.

@SubscribeEvent
public void tickServer(TickEvent.WorldTickEvent event) {
    if (event.world.provider instanceof WorldProviderTropicraft) {
        WorldDataInstance storage = event.world.getCapability(Tropicraft.WORLD_DATA_INSTANCE, null);
        if (storage != null) {
            storage.tick();
        }
    }
    if (!lookupDimIDToRegisteredListener.contains(event.world.provider.getDimension())) {
        System.out.println("adding world listener for dim " + event.world.provider.getDimension());
        event.world.addEventListener(new WorldEventListener());
        lookupDimIDToRegisteredListener.add(event.world.provider.getDimension());
    }
}
Also used : WorldEventListener(net.tropicraft.core.common.worldgen.village.WorldEventListener) WorldProviderTropicraft(net.tropicraft.core.common.dimension.WorldProviderTropicraft) WorldDataInstance(net.tropicraft.core.common.capability.WorldDataInstance) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 WorldDataInstance (net.tropicraft.core.common.capability.WorldDataInstance)1 WorldProviderTropicraft (net.tropicraft.core.common.dimension.WorldProviderTropicraft)1 WorldEventListener (net.tropicraft.core.common.worldgen.village.WorldEventListener)1