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

The following are Jave code examples for showing how to use isBurning() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: uniquecrops   File: MaryJane.java   View Source Code Vote up 6 votes
@Override
public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, @Nullable ItemStack stack) {
	
	if (this.getAge(state) >= this.getMaxAge()) {
		if (player == null)
			return;
		
		if (!player.capabilities.isCreativeMode && (player.isBurning() && player.isImmuneToFire()) || (!player.isBurning()))
		{
			world.setBlockState(pos.add(0, -1, 0), Blocks.DIRT.getDefaultState(), 2);
			world.setBlockState(pos, Blocks.FIRE.getDefaultState(), 2);
			return;
		}
	}
	super.harvestBlock(world, player, pos, state, te, stack);
}
 
Example 2
Project: AdvancedCombat   File: ItemArmorWood.java   View Source Code Vote up 6 votes
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack armor) {
	if(!world.isRemote) {
		
		// flammability: 5 damage to the armor per second
		if(player.isBurning() && player.ticksExisted % 4 == 0) {
			armor.damageItem(1, player);
		}
		
		// ecological II: repair 1 damage per second when wet
		// repair 1 damage per 12 seconds when not wet
		if(armor.getItemDamage() > 0) {
			if((player.isWet() && player.ticksExisted % 20 == 0) || player.ticksExisted % 240 == 0) {
				armor.damageItem(-1, player);
			}
		}
	}
}
 
Example 3
Project: uniquecrops   File: GrowthSteps.java   View Source Code Vote up 5 votes
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {

	if (getTile(world, pos) == null)
		return false;
	
	List<EntityPlayer> players = world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.add(-range, -range, -range), pos.add(range, range, range)));
	for (EntityPlayer player : players) {
		if (player.getUniqueID().equals(getTile(world, pos).getOwner())) {
			if (player.isBurning() && !player.isImmuneToFire())
				return true;
		}
	}
	return false;
}