Advertisement
Guest User

Untitled

a guest
Mar 9th, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.88 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.             EntityLivingBase entity = event.entityLiving;
  21.            
  22.             if (entity instanceof EntityPlayer) {
  23.                    
  24.                 if (((EntityPlayer) entity).capabilities.isCreativeMode == true) {
  25.                             return;
  26.                     }
  27.                
  28.                 else if (((EntityPlayer) entity).capabilities.isCreativeMode == false) {
  29.                             BiomeGenBase location = event.entityLiving.worldObj.getBiomeGenForCoords((int) event.entityLiving.posX, (int) event.entityLiving.posZ);
  30.                            
  31.                            
  32.                             if (location == BiomeGenBase.hell) {
  33.                                 if (message == 0)
  34.                                 {
  35.                                     ((EntityPlayer) entity).addChatMessage("Vous devez retourner sur le rivage !");
  36.                                     message = 1;
  37.                                 }
  38.                                    
  39.                                 if(Timer1 == 0)
  40.                                 {
  41.                                
  42.                                         if (location == BiomeGenBase.hell) {
  43.                                             entity.addPotionEffect(new PotionEffect(Potion.blindness.id, 2000, 4));
  44.                                             entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 2000, 4));
  45.                                             entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2000, 4));
  46.                                             Timer2 --;
  47.                                             System.out.println(Timer2);
  48.                                             System.out.println(message);
  49.                                         }
  50.                                        
  51.                                         if(Timer2 == 0)
  52.                                         {
  53.                                              System.out.println(Timer1);
  54.                                             message = 0;
  55.                                                 BiomeGenBase nextLocationPos = entity.worldObj.getBiomeGenForCoords((int) entity.posX + 51, (int) entity.posZ + 51);
  56.                                             BiomeGenBase nextLocationNeg = entity.worldObj.getBiomeGenForCoords((int) entity.posX - 51, (int) entity.posZ - 51);
  57.                                             if (nextLocationPos != BiomeGenBase.hell) {
  58.                                                     entity.posX += 51;
  59.                                                     entity.posZ += 51;
  60.                                                     ((EntityPlayer) entity).addChatMessage("La mer vous a rejetée ici...");
  61.                                                     entity.addPotionEffect(new PotionEffect(Potion.blindness.id, 0, 0));
  62.                                                     entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 0, 0));
  63.                                                     entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 0, 0));
  64.                                             } else if (nextLocationNeg != BiomeGenBase.hell) {
  65.                                                     entity.posX -= 51;
  66.                                                     entity.posZ -= 51;
  67.                                                     ((EntityPlayer) entity).addChatMessage("La mer vous a rejetée ici...");
  68.                                                     entity.addPotionEffect(new PotionEffect(Potion.blindness.id, 0, 0));
  69.                                                     entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 0, 0));
  70.                                                     entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 0, 0));
  71.                                             }
  72.                                         }
  73.                                         Timer1 = 200;
  74.                                         Timer2 = 100;
  75.                                     }
  76.                                     else
  77.                                     {
  78.                                             Timer1 --;
  79.                                             message = 1;
  80.                                     }
  81.                                     }
  82.                                  }
  83.                             }
  84.                     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement