Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package CoeBordure;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.potion.Potion;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.world.biome.BiomeGenBase;
- import net.minecraftforge.event.ForgeSubscribe;
- import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
- public class LogiBordure
- {
- private int Timer2 = 200;
- private int Timer1 = 100;
- private int message = 0;
- @ForgeSubscribe
- public void onUpdate(LivingUpdateEvent event)
- {
- EntityLivingBase entity = event.entityLiving;
- if(entity instanceof EntityPlayer)
- {
- if(((EntityPlayer)entity).capabilities.isCreativeMode == true)
- {
- return;
- }
- else if(((EntityPlayer)entity).capabilities.isCreativeMode == false)
- {
- BiomeGenBase location = event.entityLiving.worldObj.getBiomeGenForCoords((int)event.entityLiving.posX, (int)event.entityLiving.posZ);
- if(location == BiomeGenBase.hell)
- {
- if(message == 0)
- {
- ((EntityPlayer)entity).addChatMessage("Vous devez retourner sur le rivage !");
- message = 1;
- }
- if(Timer1 == 0)
- {
- if(location == BiomeGenBase.hell)
- {
- entity.addPotionEffect(new PotionEffect(Potion.blindness.id, 2000, 4));
- entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 2000, 4));
- entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2000, 4));
- Timer2--;
- System.out.println(Timer2);
- System.out.println(message);
- }
- if(Timer2 == 0)
- {
- System.out.println(Timer1);
- message = 0;
- BiomeGenBase nextLocationPos = entity.worldObj.getBiomeGenForCoords((int)entity.posX + 51, (int)entity.posZ + 51);
- BiomeGenBase nextLocationNeg = entity.worldObj.getBiomeGenForCoords((int)entity.posX - 51, (int)entity.posZ - 51);
- if(nextLocationPos != BiomeGenBase.hell)
- {
- entity.posX += 51;
- entity.posZ += 51;
- ((EntityPlayer)entity).addChatMessage("La mer vous a rejetée ici...");
- entity.addPotionEffect(new PotionEffect(Potion.blindness.id, 0, 0));
- entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 0, 0));
- entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 0, 0));
- }
- else if(nextLocationNeg != BiomeGenBase.hell)
- {
- entity.posX -= 51;
- entity.posZ -= 51;
- ((EntityPlayer)entity).addChatMessage("La mer vous a rejetée ici...");
- entity.addPotionEffect(new PotionEffect(Potion.blindness.id, 0, 0));
- entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 0, 0));
- entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 0, 0));
- }
- Timer2 = 100;
- }
- else
- {
- Timer2--;
- }
- Timer1 = 200;
- }
- else
- {
- Timer1--;
- message = 1;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement