Java Code Examples for net.minecraft.entity.player.EntityPlayer#isBurning()

The following examples show how to use net.minecraft.entity.player.EntityPlayer#isBurning() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InfernalWandUpdate.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
public void onUpdate(ItemStack itemstack, EntityPlayer player) {
    if(player.ticksExisted % 100 == 0){
        if(player.worldObj.provider.dimensionId == -1){
            for(int x = 0;x < primals.length;x++){
                if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) / 10) {
                    ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
                }
            }
        }
        
        if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, Aspect.FIRE) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) / 5) {
            ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, Aspect.FIRE, 1, true);
        }
    }
    
    if(player.isBurning())
        player.extinguish();
        
    if(player.isPotionActive(Potion.wither.id)) {
        if(player.worldObj.isRemote)
            player.removePotionEffectClient(Potion.wither.id);
        else
            player.removePotionEffect(Potion.wither.id);
    }
}
 
Example 2
Source File: MoCEntityHorse.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public void NightmareEffect()
{
    int i = MathHelper.floor_double(posX);
    int j = MathHelper.floor_double(boundingBox.minY);
    int k = MathHelper.floor_double(posZ);
    worldObj.setBlock(i - 1, j, k - 1, Block.fire.blockID, 0, 3);//MC1.5
    EntityPlayer entityplayer = (EntityPlayer) riddenByEntity;
    if ((entityplayer != null) && (entityplayer.isBurning()))
    {
        // entityplayer.fire = 0;
        entityplayer.extinguish();
    }
    setNightmareInt(getNightmareInt() - 1);
}
 
Example 3
Source File: OvenGlove.java    From NewHorizonsCoreMod with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onWornTick( ItemStack arg0, EntityLivingBase pEntity )
{
  try
  {
    if( !( pEntity instanceof EntityPlayer ) ) {
      return;
    }

    if( arg0.getItemDamage() == 1 ) // MetaItem 0 is running this loop only
    {
      return;
    }

    EntityPlayer tPlayer = (EntityPlayer) pEntity;
    InventoryBaubles tBaubles = PlayerHandler.getPlayerBaubles( tPlayer );

    if( tPlayer.isBurning() ) // no fire/lava cheat!
    {
      if( isGlovesResistActive( tPlayer ) ) {
        RemoveFireProtection(pEntity);
      }
      return;
    }

    if( _mRnd.nextInt( 20 ) == 0 )
    {
      // Player must wear OvenGloves in both slots
      ItemStack tBaubleRing1 = tBaubles.stackList[1];
      ItemStack tBaubleRing2 = tBaubles.stackList[2];

      if( tBaubleRing1 == null || tBaubleRing2 == null )
      {
        // Log("Bauble 1 or 2 is null");
        return;
      }

      if( tBaubleRing1.getUnlocalizedName().contains( _mItemName ) && tBaubleRing2.getUnlocalizedName().contains( _mItemName ) )
      {
        if( tBaubleRing1.getItemDamage() != 0 || tBaubleRing2.getItemDamage() != 1 )
        {
          if( FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT )
          {
            if( !WrongSidePopupShown )
            {
              WrongSidePopupShown = true;
              Notification noti = new Notification( tBaubleRing1, "Wrong place", "The gloves feel weird..." );
              NotificationTickHandler.guiNotification.queueNotification( noti );
            }
          }
          // Log("Gloves in wrong spots");
          return;
        }
        
        if( tBaubleRing1.stackTagCompound == null || tBaubleRing2.stackTagCompound == null ) // Cheated gloves don't have NBT tags sometimes
        {
          return;
        }

        if( tBaubleRing1.stackTagCompound.getInteger( NBTTAG_DURABILITY ) <= 1 || tBaubleRing2.stackTagCompound.getInteger( NBTTAG_DURABILITY ) <= 1 ) {
          return;
        }

        ItemStack tHeldItem = tPlayer.getCurrentEquippedItem();
        if( tHeldItem != null )
        {
          // Update 12.01.2017: Player must hold any item containing Lava
          if( isValidLavaContainerItem( tHeldItem ) )
          {
            if( !isResistActive( tPlayer ) || isGlovesResistActive( tPlayer ) )
            {
              tPlayer.addPotionEffect( new PotionEffect( Potion.fireResistance.id, potionDuration, potionAmplifier, potionAmbient ) );

              int tRandomDamage = _mRnd.nextInt( 10 ); // Randomly damage gloves while giving the protection effect

              if( tRandomDamage == 1 ) {
                DamageItem(tBaubleRing1);
              } else if( tRandomDamage == 2 ) {
                DamageItem(tBaubleRing2);
              }
            }
          }
        }
      }
    }
  }
  catch (Exception e) // Fail-safe for all future crashes
  {
    e.printStackTrace();
  }
}