Skip to content

Commit

Permalink
Merge branch '1.10.2' of https://github.com/squeek502/AppleCore into …
Browse files Browse the repository at this point in the history
…1.11
  • Loading branch information
squeek502 committed Dec 31, 2016
2 parents 1b25b76 + f6d06b2 commit fca5ccc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions java/squeek/applecore/network/SyncHandler.java
@@ -1,12 +1,14 @@
package squeek.applecore.network;

import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.relauncher.Side;
import squeek.applecore.ModInfo;
Expand All @@ -27,6 +29,15 @@ public static void init()
*/
private EnumDifficulty lastDifficultySetting = null;

@SubscribeEvent
public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event)
{
if (!(event.player instanceof EntityPlayerMP))
return;

CHANNEL.sendTo(new MessageDifficultySync(event.player.world.getDifficulty()), (EntityPlayerMP) event.player);
}

@SubscribeEvent
public void onWorldTick(WorldTickEvent event)
{
Expand Down

0 comments on commit fca5ccc

Please sign in to comment.