Advertisement
robin4002

Untitled

Mar 9th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.94 KB | None | 0 0
  1. package CoeBordure;
  2.  
  3. import net.minecraft.entity.EntityLivingBase;
  4. import net.minecraft.entity.player.EntityPlayer;
  5. import net.minecraft.potion.Potion;
  6. import net.minecraft.potion.PotionEffect;
  7. import net.minecraft.world.biome.BiomeGenBase;
  8. import net.minecraftforge.event.ForgeSubscribe;
  9. import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
  10.  
  11. public class LogiBordure
  12. {
  13.  
  14.     private int Timer2 = 200;
  15.     private int Timer1 = 100;
  16.     private int message = 0;
  17.  
  18.     @ForgeSubscribe
  19.     public void onUpdate(LivingUpdateEvent event)
  20.     {
  21.         EntityLivingBase entity = event.entityLiving;
  22.  
  23.         if(entity instanceof EntityPlayer)
  24.         {
  25.  
  26.             if(((EntityPlayer)entity).capabilities.isCreativeMode == true)
  27.             {
  28.                 return;
  29.             }
  30.  
  31.             else if(((EntityPlayer)entity).capabilities.isCreativeMode == false)
  32.             {
  33.                 BiomeGenBase location = event.entityLiving.worldObj.getBiomeGenForCoords((int)event.entityLiving.posX, (int)event.entityLiving.posZ);
  34.  
  35.                 if(location == BiomeGenBase.hell)
  36.                 {
  37.                     if(message == 0)
  38.                     {
  39.                         ((EntityPlayer)entity).addChatMessage("Vous devez retourner sur le rivage !");
  40.                         message = 1;
  41.                     }
  42.  
  43.                     if(Timer1 == 0)
  44.                     {
  45.  
  46.                         if(location == BiomeGenBase.hell)
  47.                         {
  48.                             entity.addPotionEffect(new PotionEffect(Potion.blindness.id, 2000, 4));
  49.                             entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 2000, 4));
  50.                             entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2000, 4));
  51.                             Timer2--;
  52.                             System.out.println(Timer2);
  53.                             System.out.println(message);
  54.                         }
  55.  
  56.                         if(Timer2 == 0)
  57.                         {
  58.                             System.out.println(Timer1);
  59.                             message = 0;
  60.                             BiomeGenBase nextLocationPos = entity.worldObj.getBiomeGenForCoords((int)entity.posX + 51, (int)entity.posZ + 51);
  61.                             BiomeGenBase nextLocationNeg = entity.worldObj.getBiomeGenForCoords((int)entity.posX - 51, (int)entity.posZ - 51);
  62.                             if(nextLocationPos != BiomeGenBase.hell)
  63.                             {
  64.                                 entity.posX += 51;
  65.                                 entity.posZ += 51;
  66.                                 ((EntityPlayer)entity).addChatMessage("La mer vous a rejetée ici...");
  67.                                 entity.addPotionEffect(new PotionEffect(Potion.blindness.id, 0, 0));
  68.                                 entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 0, 0));
  69.                                 entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 0, 0));
  70.                             }
  71.                             else if(nextLocationNeg != BiomeGenBase.hell)
  72.                             {
  73.                                 entity.posX -= 51;
  74.                                 entity.posZ -= 51;
  75.                                 ((EntityPlayer)entity).addChatMessage("La mer vous a rejetée ici...");
  76.                                 entity.addPotionEffect(new PotionEffect(Potion.blindness.id, 0, 0));
  77.                                 entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 0, 0));
  78.                                 entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 0, 0));
  79.                             }
  80.                             Timer2 = 100;
  81.                         }
  82.                         else
  83.                         {
  84.                             Timer2--;
  85.                         }
  86.                         Timer1 = 200;
  87.                     }
  88.                     else
  89.                     {
  90.                         Timer1--;
  91.                         message = 1;
  92.                     }
  93.                 }
  94.             }
  95.         }
  96.     }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement