AlphaSwittleTeam

EventHandlerPart

Mar 8th, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.62 KB | None | 0 0
  1.     @ForgeSubscribe
  2.     public void onUpdate(LivingUpdateEvent event) {
  3.         EntityLivingBase entity = event.entityLiving;
  4.         if (entity instanceof EntityPlayer) {
  5.             if (((EntityPlayer) entity).capabilities.isCreativeMode == true) {
  6.                 return;
  7.             } else if (((EntityPlayer) entity).capabilities.isCreativeMode == false) {
  8.                 BiomeGenBase location = event.entityLiving.worldObj.getBiomeGenForCoords((int) event.entityLiving.posX, (int) event.entityLiving.posZ);
  9.                 if (location == BiomeGenBase.hell) {
  10.                     ((EntityPlayer) entity).addChatMessage("Vous devez retournez sur le rivage !");
  11.                     /**
  12.                      * Je n'ai pas trouv� comment attendre 10 secondes, d�sol�
  13.                      * :)
  14.                      */
  15.                     if (location == BiomeGenBase.hell) {
  16.                         entity.addPotionEffect(new PotionEffect(Potion.blindness.id, 2000, 4));
  17.                         entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 2000, 4));
  18.                         entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2000, 4));
  19.                     }
  20.                     /**
  21.                      * Ici pareil
  22.                      */
  23.                     BiomeGenBase nextLocationPos = entity.worldObj.getBiomeGenForCoords((int) entity.posX + 51, (int) entity.posZ + 51);
  24.                     BiomeGenBase nextLocationNeg = entity.worldObj.getBiomeGenForCoords((int) entity.posX - 51, (int) entity.posZ - 51);
  25.                     if (nextLocationPos != BiomeGenBase.hell) {
  26.                         entity.posX += 51;
  27.                         entity.posZ += 51;
  28.                         ((EntityPlayer) entity).addChatMessage("La mer vous a rejet� ici...");
  29.                     } else if (nextLocationNeg != BiomeGenBase.hell) {
  30.                         entity.posX -= 51;
  31.                         entity.posZ -= 51;
  32.                         ((EntityPlayer) entity).addChatMessage("La mer vous a rejet� ici...");
  33.                     }
  34.                 }
  35.             }
  36.         }
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment