2013-06-15 11:08:58 +00:00
|
|
|
package biomesoplenty.handlers;
|
2013-06-14 13:17:48 +00:00
|
|
|
|
|
|
|
import java.util.EnumSet;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2013-10-20 08:07:34 +00:00
|
|
|
import net.minecraft.util.ChatMessageComponent;
|
|
|
|
import net.minecraft.util.EnumChatFormatting;
|
2013-09-26 03:50:38 +00:00
|
|
|
import biomesoplenty.helpers.Version;
|
2013-06-14 13:17:48 +00:00
|
|
|
import cpw.mods.fml.common.ITickHandler;
|
|
|
|
import cpw.mods.fml.common.Loader;
|
|
|
|
import cpw.mods.fml.common.TickType;
|
2013-10-20 08:07:34 +00:00
|
|
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
2013-06-14 13:17:48 +00:00
|
|
|
|
|
|
|
public class TickHandlerClient implements ITickHandler
|
|
|
|
{
|
|
|
|
private boolean nagged;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void tickStart(EnumSet<TickType> type, Object... tickData)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void tickEnd(EnumSet<TickType> type, Object... tickData)
|
|
|
|
{
|
|
|
|
if (nagged)
|
|
|
|
return;
|
|
|
|
|
|
|
|
EntityPlayer player = (EntityPlayer) tickData[0];
|
|
|
|
|
2013-09-26 03:50:38 +00:00
|
|
|
if (Version.needsBOPWorldtypeAndMarkAsSeen(player.worldObj))
|
2013-06-14 23:16:58 +00:00
|
|
|
{
|
2013-10-20 08:07:34 +00:00
|
|
|
ChatMessageComponent updateMessage = new ChatMessageComponent();
|
|
|
|
updateMessage.setColor(EnumChatFormatting.RED);
|
2013-10-22 09:14:19 +00:00
|
|
|
|
2013-10-20 08:07:34 +00:00
|
|
|
updateMessage.addKey("phrase.bop.useBOPWorldtype");
|
2013-10-22 09:14:19 +00:00
|
|
|
if (Loader.isModLoaded("ATG")) updateMessage.addKey("phrase.bop.useBOPATGWorldtype");
|
|
|
|
else updateMessage.addKey("phrase.bop.useBOPWorldtype");
|
|
|
|
|
2013-10-20 08:07:34 +00:00
|
|
|
player.sendChatToPlayer(updateMessage);
|
2013-06-14 23:16:58 +00:00
|
|
|
}
|
|
|
|
|
2013-09-26 03:50:38 +00:00
|
|
|
if (Version.needsUpdateNoticeAndMarkAsSeen())
|
2013-06-14 13:17:48 +00:00
|
|
|
{
|
2013-10-20 08:07:34 +00:00
|
|
|
ChatMessageComponent updateMessage = new ChatMessageComponent();
|
2013-10-22 09:14:19 +00:00
|
|
|
updateMessage.setColor(EnumChatFormatting.RED);
|
2013-10-20 08:07:34 +00:00
|
|
|
updateMessage.addFormatted("phrase.bop.updateAvaliable", Version.getRecommendedVersion(), Loader.instance().getMinecraftModContainer().getVersion());
|
|
|
|
player.sendChatToPlayer(updateMessage);
|
2013-06-14 13:17:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nagged = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public EnumSet<TickType> ticks()
|
|
|
|
{
|
|
|
|
return EnumSet.of(TickType.PLAYER);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getLabel()
|
|
|
|
{
|
|
|
|
return "BiomesOPlenty - Player update tick";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|