Mekanism-tilera-Edition/common/mekanism/common/CommonPlayerTracker.java
2013-12-22 01:49:55 -05:00

47 lines
1.6 KiB
Java

package mekanism.common;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketConfigSync;
import mekanism.common.network.PacketJetpackData;
import mekanism.common.network.PacketJetpackData.JetpackPacket;
import mekanism.common.network.PacketScubaTankData;
import mekanism.common.network.PacketScubaTankData.ScubaTankPacket;
import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.IPlayerTracker;
public class CommonPlayerTracker implements IPlayerTracker
{
@Override
public void onPlayerLogin(EntityPlayer player)
{
if(!player.worldObj.isRemote)
{
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketConfigSync().setParams(), player);
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketJetpackData().setParams(JetpackPacket.FULL), player);
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketScubaTankData().setParams(ScubaTankPacket.FULL), player);
System.out.println("[Mekanism] Sent config to '" + player.username + ".'");
}
}
@Override
public void onPlayerLogout(EntityPlayer player)
{
Mekanism.jetpackOn.remove(player);
Mekanism.gasmaskOn.remove(player);
}
@Override
public void onPlayerChangedDimension(EntityPlayer player)
{
Mekanism.jetpackOn.remove(player);
if(!player.worldObj.isRemote)
{
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketJetpackData().setParams(JetpackPacket.FULL), player);
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketScubaTankData().setParams(ScubaTankPacket.FULL), player);
}
}
@Override
public void onPlayerRespawn(EntityPlayer player) {}
}