package rtk;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.entity.RenderIronGolem;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagIntArray;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import rtk.common.CNBT;
import rtk.item.ItemToolbelt;

public class ModEvents {
    @SubscribeEvent
    public void onPlayerInteract(PlayerInteractEvent.LeftClickBlock event){
        EntityPlayer player = event.getEntityPlayer();
        for(int i = 0; i < player.inventory.getSizeInventory(); i++){
            ItemStack stack = player.inventory.getStackInSlot(i);
            if(stack != null && stack.getItem() instanceof ItemToolbelt){
                ItemToolbelt.selectBestTool(player, i);
                return;
            }
        }
    }

//    @SubscribeEvent
//    public void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event){
//        if(event.player.world.isRemote || event.player.capabilities.isCreativeMode)
//            return;
//
//        NBTTagCompound playerData = event.player.getEntityData();
//        NBTTagCompound persist = CNBT.ensureCompound(playerData, EntityPlayer.PERSISTED_NBT_TAG);
//
//        if(!persist.getBoolean("GivenTent")){
//            event.player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.emergencyTent));
//            persist.setBoolean("GivenTent", true);
//            playerData.setTag(EntityPlayer.PERSISTED_NBT_TAG, persist);
//        }
//    }
}

@@ -1528,18 +1528,16 @@
 %0A    %7D%0A%0A
-//
     @Sub
@@ -1548,18 +1548,16 @@
 beEvent%0A
-//
     publ
@@ -1617,18 +1617,16 @@
 event)%7B%0A
-//
         
@@ -1701,18 +1701,16 @@
 veMode)%0A
-//
         
@@ -1721,21 +1721,17 @@
 return;%0A
-//%0A//
+%0A
         
@@ -1788,18 +1788,16 @@
 Data();%0A
-//
         
@@ -1890,13 +1890,9 @@
 G);%0A
-//%0A//
+%0A
     
@@ -1933,18 +1933,16 @@
 ent%22))%7B%0A
-//
         
@@ -2033,18 +2033,16 @@
 Tent));%0A
-//
         
@@ -2084,18 +2084,16 @@
  true);%0A
-//
         
@@ -2156,18 +2156,16 @@
 rsist);%0A
-//
         
@@ -2170,10 +2170,8 @@
   %7D%0A
-//
     

Add back feature to give players emergency tent on spawn.