Guest User

EntityAdvancedFrame

a guest
Jan 22nd, 2015
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.28 KB | None | 0 0
  1. public class EntityAdvancedFrame extends EntityItemFrame{
  2.  
  3.    
  4.     public EntityAdvancedFrame(World world) {
  5.         super(world);
  6.     }
  7.     public EntityAdvancedFrame(World world, int p_i1591_2_, int p_i1591_3_, int p_i1591_4_, int p_i1591_5_)
  8.     {
  9.         super(world, p_i1591_2_, p_i1591_3_, p_i1591_4_, p_i1591_5_);
  10.        
  11.     }
  12.  
  13.     /**
  14.      * Called when the entity is attacked.
  15.      */
  16.     public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
  17.     {
  18.         //Here we check if player, who trying to destroy frame is opped
  19.         if(Arrays.asList(MinecraftServer.getServer().getConfigurationManager().func_152603_m().func_152685_a()).contains(((EntityPlayer) p_70097_1_.getEntity()).getDisplayName()))
  20.         {
  21.             if (this.isEntityInvulnerable())
  22.             {
  23.                 return false;
  24.             }
  25.             else if (this.getDisplayedItem() != null)
  26.             {
  27.                 if (!this.worldObj.isRemote)
  28.                 {
  29.                     this.func_146065_b(p_70097_1_.getEntity(), false);
  30.                     this.setDisplayedItem((ItemStack)null);
  31.                 }
  32.    
  33.                 return true;
  34.             }
  35.             else
  36.             {
  37.                 return super.attackEntityFrom(p_70097_1_, p_70097_2_);
  38.             }
  39.         } else {
  40.             return false;
  41.         }
  42.            
  43.      }
  44.  
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment