Advertisement
WackoMcGoose

BlockCactusPoison

Feb 3rd, 2012
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.04 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. public class BlockCactusPoison extends BlockCactus
  4. {
  5.     protected BlockCactusPoison(int i, int j)
  6.     {
  7.         super(i, j); //Params %blockID%, %textureIndex%, Material.cactus
  8.         setTickOnLoad(true);
  9.     }
  10.    
  11.     @Override
  12.     public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
  13.     {
  14.         //le EntityCaveSpider spork
  15.         if (entity instanceof EntityLiving)
  16.         {
  17.             byte byte0 = 0;
  18.             if (world.difficultySetting > 1)
  19.             {
  20.                 if (world.difficultySetting == 2)
  21.                 {
  22.                     byte0 = 7;
  23.                 }
  24.                 else if (world.difficultySetting == 3)
  25.                 {
  26.                     byte0 = 15;
  27.                 }
  28.             }
  29.             if (byte0 > 0)
  30.             {
  31.                 ((EntityLiving)entity).addPotionEffect(new PotionEffect(Potion.poison.id, byte0 * 20, 0));
  32.             }
  33.         }
  34.         //end spork
  35.     }
  36.    
  37.     @Override
  38.     public int getBlockTextureFromSide(int i)
  39.     {
  40.         if (i == 1)
  41.         {
  42.             return mod_EvilMinecraft_Fragment.poisonCactusTextureIndexTop;
  43.         }
  44.         if (i == 0)
  45.         {
  46.             return mod_EvilMinecraft_Fragment.poisonCactusTextureIndexBottom;
  47.         }
  48.         else
  49.         {
  50.             return mod_EvilMinecraft_Fragment.poisonCactusTextureIndexSide;
  51.         }
  52.     }
  53.    
  54.     @Override
  55.     public boolean canBlockStay(World world, int i, int j, int k)
  56.     {
  57.         if (world.getBlockMaterial(i - 1, j, k).isSolid())
  58.         {
  59.             return false;
  60.         }
  61.         if (world.getBlockMaterial(i + 1, j, k).isSolid())
  62.         {
  63.             return false;
  64.         }
  65.         if (world.getBlockMaterial(i, j, k - 1).isSolid())
  66.         {
  67.             return false;
  68.         }
  69.         if (world.getBlockMaterial(i, j, k + 1).isSolid())
  70.         {
  71.             return false;
  72.         }
  73.         else
  74.         {
  75.             int l = world.getBlockId(i, j - 1, k);
  76.             return l == this.blockID || l == Block.sand.blockID;
  77.         }
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement