Camellias_

TileEntityTimeAnomaly.class

Feb 17th, 2018
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.92 KB | None | 0 0
  1. package com.camellias.temporalmod.tileentities;
  2.  
  3. import java.util.List;
  4.  
  5. import net.minecraft.entity.player.EntityPlayer;
  6. import net.minecraft.init.MobEffects;
  7. import net.minecraft.potion.PotionEffect;
  8. import net.minecraft.tileentity.TileEntity;
  9. import net.minecraft.util.ITickable;
  10. import net.minecraft.util.math.AxisAlignedBB;
  11.  
  12. public class TileEntityTimeAnomaly extends TileEntity implements ITickable
  13. {
  14.    
  15.     public void setName(String displayName)
  16.     {
  17.        
  18.     }
  19.    
  20.     private void addEffectsToPlayers()
  21.     {
  22.         List<EntityPlayer> itemsOnGround = getWorld().getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(getPos()).grow(3, 0, 3));
  23.        
  24.         if (!this.world.isRemote)
  25.         {
  26.             double d0 = (double)(10 + 10);
  27.             int i = 20;
  28.  
  29.             int j = 1;
  30.             int k = this.pos.getX();
  31.             int l = this.pos.getY();
  32.             int i1 = this.pos.getZ();
  33.             AxisAlignedBB axisalignedbb = (new AxisAlignedBB((double)k, (double)l, (double)i1, (double)(k + 1), (double)(l + 1), (double)(i1 + 1))).grow(d0).expand(0.0D, (double)this.world.getHeight(), 0.0D);
  34.             List<EntityPlayer> list = getWorld().getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(getPos()).grow(5, 3, 5));
  35.  
  36.             for (EntityPlayer entityplayer : list)
  37.             {
  38.                 entityplayer.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, j, i, true, true));
  39.                 entityplayer.addPotionEffect(new PotionEffect(MobEffects.HUNGER, j, i, true, true));
  40.                 entityplayer.addPotionEffect(new PotionEffect(MobEffects.WITHER, j, i, true, true));
  41.             }
  42.         }
  43.     }
  44.    
  45.     @Override
  46.     public void update()
  47.     {
  48.         if (this.world.getTotalWorldTime() % 80L == 0L)
  49.         {
  50.             this.updateAnom();
  51.         }
  52.     }
  53.    
  54.     private void updateAnom()
  55.     {
  56.         if (this.world != null)
  57.         {
  58.             this.addEffectsToPlayers();
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment