Search in sources :

Example 1 with MessageMineralListSync

use of blusunrize.immersiveengineering.common.util.network.MessageMineralListSync in project ImmersiveEngineering by BluSunrize.

the class EventHandler method onLogin.

@SubscribeEvent(priority = EventPriority.HIGH)
public void onLogin(PlayerLoggedInEvent event) {
    ExcavatorHandler.allowPackets = true;
    if (!event.player.worldObj.isRemote) {
        HashMap<MineralMix, Integer> packetMap = new HashMap<MineralMix, Integer>();
        for (Entry<MineralMix, Integer> e : ExcavatorHandler.mineralList.entrySet()) if (e.getKey() != null && e.getValue() != null)
            packetMap.put(e.getKey(), e.getValue());
        ImmersiveEngineering.packetHandler.sendToAll(new MessageMineralListSync(packetMap));
    }
}
Also used : MessageMineralListSync(blusunrize.immersiveengineering.common.util.network.MessageMineralListSync) MineralMix(blusunrize.immersiveengineering.api.tool.ExcavatorHandler.MineralMix) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with MessageMineralListSync

use of blusunrize.immersiveengineering.common.util.network.MessageMineralListSync in project ImmersiveEngineering by BluSunrize.

the class ExcavatorHandler method recalculateChances.

public static void recalculateChances(boolean mutePackets) {
    for (Map.Entry<MineralMix, Integer> e : mineralList.entrySet()) e.getKey().recalculateChances();
    dimensionBasedTotalWeight.clear();
    if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && allowPackets && !mutePackets) {
        HashMap<MineralMix, Integer> packetMap = new HashMap<MineralMix, Integer>();
        for (Map.Entry<MineralMix, Integer> e : ExcavatorHandler.mineralList.entrySet()) if (e.getKey() != null && e.getValue() != null)
            packetMap.put(e.getKey(), e.getValue());
        ImmersiveEngineering.packetHandler.sendToAll(new MessageMineralListSync(packetMap));
    }
}
Also used : MessageMineralListSync(blusunrize.immersiveengineering.common.util.network.MessageMineralListSync)

Aggregations

MessageMineralListSync (blusunrize.immersiveengineering.common.util.network.MessageMineralListSync)2 MineralMix (blusunrize.immersiveengineering.api.tool.ExcavatorHandler.MineralMix)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1